JSON helper functions
JSON processing and output functions
Automatically imports rapidjson if present
-
pyaltt2.json.
dumps
(data, pretty=False, unpicklable=False, pickle_opts={}, **kwargs) Dump to JSON
Parameters: - data – data to dump
- pretty – set indent and sort keys
- unpicklable – one-way dump for complex objects (requires jsonpickle)
- pickle_opts – sent to jsonpickle.encode() as-is
- **kwargs – sent to json.dumps() as-is
-
pyaltt2.json.
jprint
(data, colored=True, force_colored=False, file=None) Pretty print JSON
Parameters: - data – data to encode and print
- colored – colorize output (default: True)
- force_colored – force colorize, even if stream is not a tty
- file – output stream (default: sys.stdout)