Class IS_JSONS3
source code
gluon.validators.Validator --+
|
IS_JSONS3
Similar to web2py's IS_JSON validator, but extended to handle
single quotes in dict keys (=invalid JSON) from CSV imports.
Example:
INPUT(_type='text', _name='name', requires=IS_JSONS3())
>>> IS_JSONS3()('{"a": 100}')
({u'a': 100}, None)
>>> IS_JSONS3()('spam1234')
('spam1234', 'invalid json')
__init__(self,
native_json=False,
error_message="Invalid JSON")
(Constructor)
| source code
|
Constructor
- Parameters:
native_json - return the JSON string rather than a Python object (e.g. when the
field is "string" type rather than "json")
error_message - the error message
|
|
Validator, validates a string and converts it into db format
|
|
Formatter, converts the db format into a string
|