{"id":21486,"library":"json-numpy","title":"json-numpy","description":"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.","status":"active","version":"2.1.1","language":"python","source_language":"en","source_url":"https://github.com/Crimson-Crow/json-numpy.git","tags":["numpy","json","serialization","encoding","decoding","arrays"],"install":[{"cmd":"pip install json-numpy","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"Core dependency for array handling","package":"numpy","optional":false}],"imports":[{"note":"Direct import of the module for conversion functions.","symbol":"json_numpy","correct":"import json_numpy"}],"quickstart":{"code":"import json_numpy\nimport numpy as np\n\narr = np.array([1, 2, 3])\nencoded = json_numpy.dumps(arr)\nprint(encoded)\ndecoded = json_numpy.loads(encoded)\nprint(decoded)","lang":"python","description":"Basic usage: encode NumPy array to JSON string and decode back."},"warnings":[{"fix":"Use json_numpy.dumps(obj, allow_nan=True).","message":"json_numpy.dumps does not encode Infinity or NaN by default; they become null. To preserve them, pass allow_nan=True.","severity":"gotcha","affected_versions":"all"},{"fix":"Use json_numpy.loads(s, as_list=True) or explicit list() after decode.","message":"Deserialization returns numpy arrays by default. To get Python lists, convert manually.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use json_numpy.dumps() and json_numpy.loads() after importing json_numpy.","cause":"Incorrect import assuming dumps/loads are top-level; they are inside json_numpy module.","error":"AttributeError: module 'json_numpy' has no attribute 'dumps'"},{"fix":"Use json_numpy.dumps(arr) instead of json.dumps(arr).","cause":"Using standard json.dumps directly on numpy arrays.","error":"TypeError: Object of type ndarray is not JSON serializable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}