Package park :: Package util :: Module codec :: Class JSON

Class JSON

source code


Codec for JSON

Basic python types (list, string, dictionary, numbers, boolean, None) are converted directly to the corresponding string representation. tuples and sets are converted to lists, and str is converted to unicode.

Python objects are represented by:

{
    '.class': 'module.classname',
    '.version': 'versionstring',
    '.state': { object state }
}

where state comes from the object __getstate__, the object __dict__ or the object __slots__. See the pickle documentation for details.

Python functions are represented by:

{
    '.function': 'module.functionname'
}
Static Methods
 
encode(s)
Convert structure to JSON string.
source code
 
decode(s)
Convert JSON string to structure.
source code
Method Details

encode(s)
Static Method

source code 
Convert structure to JSON string.
Overrides: Codec.encode

decode(s)
Static Method

source code 
Convert JSON string to structure.
Overrides: Codec.decode