msl.network.json module
This module is used as the JSON (de)serializer.
- class msl.network.json.Package(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
EnumSupported Python packages for (de)serializing JSON objects.
By default, the builtin
jsonmodule is used.To change which JSON package to use you can call
use()to set the backend during runtime, or you can specify anMSL_NETWORK_JSONenvironment variable as the default backend. For example, creating an environment variable namedMSL_NETWORK_JSONand setting its value to beULTRAwould use UltraJSON to (de)serialize JSON objects.Changed in version 1.0: Moved from the
msl.network.constantsmodule and renamed. AddedJSON,UJSON,RAPIDJSONandSIMPLEJSONaliases. AddedOR(and aliasORJSON) for orjson. RemovedYAJL.- SIMPLE = 'SIMPLE'
- SIMPLEJSON = 'SIMPLE'
- msl.network.json.use(value)[source]
Set which JSON backend to use.
New in version 1.0.
Examples
>>> from msl.network import json >>> json.use(json.Package.UJSON) >>> json.use('ujson')