nanshe.io.xjson module¶
The module xjson
serializes JSON with some additional features.
Overview¶
The module xjson
provides a mechanism of serializing JSON in a way that
allows for a few additional constraints.
- Commenting – does not break the JSON specification (e.g. adding the prefix
__comment__
to any string). - Order dependent deserialization – dictionary order is preserved.
- ASCII strings – all strings are converted to ASCII
API¶
-
nanshe.io.xjson.
read_parameters
(*args, **kwargs)[source]¶ Reads the contents of a json config file and returns the parameters.
Parameters: - config_filename (str) – name of the file to read.
- maintain_order (bool) – whether to preserve the order of keys in the json file
Returns: - parameters read
from the file.
Return type: parameters (dict or collections.OrderedDict)