--- id: numpyencoder version: "0.3.2" license: MIT license_treatment: permissive maintenance: aging --- # numpyencoder — Python JSON encoder for handling Numpy data types. License: permissive · Maintenance: aging · Downloads: 168.6K/mo ## What it is and what it does numpyencoder is a lightweight JSON encoder that extends Python's standard json module to handle NumPy data types. When you try to serialize a NumPy array or scalar using the standard json.dump() or json.dumps(), you normally get a TypeError; this package provides a NumpyEncoder class that you pass as the cls parameter to transparently convert NumPy objects into JSON-serializable Python types. The package depends on numpy and packaging. It's designed for workflows where you're working with NumPy arrays or calculations and need to write results to JSON files or transmit them over JSON APIs without writing custom conversion logic. The encoder integrates directly into Python's json module, so you use it by simply specifying cls=NumpyEncoder in your json.dump() call. Use it for: - Save NumPy computation results (arrays, statistics) to JSON configuration or data files - Serialize machine learning model outputs or intermediate arrays for logging or API responses - Convert NumPy-based scientific data to JSON for web APIs or inter-process communication - Export numerical simulation or analysis results to JSON-compatible formats without manual type conversion ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a custom JSON encoder class that serializes NumPy data types (arrays, scalars, etc.) to JSON-compatible formats, allowing NumPy objects to be written directly to JSON files without manual conversion. Yes, if you regularly work with NumPy and need to serialize to JSON. The package is lightweight, has no known vulnerabilities, and uses a permissive license. Maintenance is aging (last release 395 days ago), so verify that it handles your specific NumPy types before relying on it for new projects; for established workflows it is a straightforward, low-risk addition. ## Install pip install numpyencoder uv add numpyencoder poetry add numpyencoder ## Installing numpyencoder Before you install: Low friction installation with a pure-Python wheel. Maintenance is aging—last release was 395 days ago—but the repository remains active and the package has been stable since its 2018 initial release. License in practice: MIT license is permissive; you may use, modify, and distribute this package freely in commercial and private projects with minimal restrictions. Quickstart: import json import numpy as np from numpyencoder import NumpyEncoder numpy_data = np.array([0, 1, 2, 3]) json.dumps(numpy_data, cls=NumpyEncoder) Verify before relying: - Which specific NumPy data types are supported (e.g., all scalar types, structured arrays, datetime64) - Performance characteristics when encoding large arrays or deeply nested NumPy structures - Compatibility with NumPy versions beyond the current release cycle ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 168.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags numpy json encoder, serialize numpy arrays to json, json encoder for numpy, numpy data type serialization, convert numpy to json, numpy json compatibility, numpy-integration, json-serialization [View on SkillFed](https://skillfed.io/packages/numpyencoder) · [View on PyPI](https://pypi.org/project/numpyencoder/)