A library for encoding and decoding NumPy arrays and scalars to/from JSON-compatible formats. Current version 2.1.1, compatible with Python >=3.8. Maintained actively.
pip install json-numpyVerified import paths — ran on the pinned version, not inferred.
Basic usage: encode NumPy array to JSON string and decode back.
Use json_numpy.dumps(obj, allow_nan=True).
Use json_numpy.loads(s, as_list=True) or explicit list() after decode.
Use json_numpy.dumps() and json_numpy.loads() after importing json_numpy.
Use json_numpy.dumps(arr) instead of json.dumps(arr).