json_utils
lacuna.core.json_utils
¶
Shared JSON serialization helpers.
NumpyJSONEncoder
¶
Bases: JSONEncoder
JSON encoder that serializes numpy scalars and arrays.
numpy types are not JSON-serializable by json out of the box, and
analysis results and provenance routinely contain them (e.g. np.float32
summary stats, np.int64 counts). Pass cls=NumpyJSONEncoder to
json.dump/json.dumps to handle them.