maxwelllink.tools.fast_json module¶
Fast JSON helpers for hot-path serialization.
Encoding and decoding live together so a single place decides whether orjson is used. Aggregate bridges encode one payload per molecule every step, so at tens of thousands of molecules this is a measurable part of the step.
- maxwelllink.tools.fast_json.json_dumps(payload)[source]¶
Encode a mapping into compact, sorted UTF-8 JSON bytes.
Notes
orjson always emits compact UTF-8, so it needs no
ensure_asciiorseparatorsargument. It writesnullfor a non-finite float where stdlib json writesNaN;nullis the parseable one, sincejson_loads()is orjson too.- Parameters:
payload (Mapping) – JSON-serializable mapping to encode.
- Returns:
Compact UTF-8 JSON with sorted keys.
- Return type:
bytes
- maxwelllink.tools.fast_json.json_loads(obj, /)¶
Deserialize JSON to Python objects.