skillfed

jsonconversion

This python module helps converting arbitrary Python objects into JSON strings and back.

jsonconversion v1.2.1 14.1M downloads/30d#1,247 on PyPI9
Permissive license BSD AGING released

What it is and what it does

jsonconversion extends Python's built-in json module to serialize and deserialize arbitrary Python objects, including custom classes, builtins (int, float, str, list, set, dict, tuple), type objects, and numpy arrays. It works by storing class metadata in the JSON output so objects can be reconstructed on deserialization.

To use it with your own classes, you inherit from JSONObject and implement to_dict and from_dict methods that define which attributes to serialize. The package handles the rest—encoding to JSON strings via JSONObjectEncoder and decoding back via JSONObjectDecoder. It's designed for scenarios where you need to persist complex Python object hierarchies as JSON, such as in web frameworks (Django, Flask) or scientific workflows.

Use it for:

  • Serialize custom Python classes to JSON for storage or transmission in web applications.
  • Round-trip complex nested data structures (objects containing other objects) to and from JSON.
  • Store scientific or numerical data with custom metadata by combining numpy arrays with JSONObject subclasses.
  • Migrate serialized objects when class module paths change using the substitute_modules parameter.
  • Extend JSON encoding for domain-specific types without modifying the standard json module.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Converts arbitrary Python objects to JSON strings and back, extending the standard json module with support for custom classes, numpy arrays, and nested structures through JSONEncoder and JSONDecoder subclasses.

Yes, if you need to serialize custom Python objects to JSON beyond what the standard json module supports. The package is stable (Production/Stable status), has no known vulnerabilities, and carries a permissive license. Install friction is low. However, maintenance is aging (last release 275 days ago), so verify that its feature set meets your needs before adopting it for new projects.

Install

jsonconversion on PyPI

pip

pip install jsonconversion

uv

uv add jsonconversion

poetry

poetry add jsonconversion

Installing jsonconversion

Before you install

Low install friction with a pure-wheel distribution. Maintenance is aging—last release 275 days ago—but the repository remains active and unarchived with recent commits.

License in practice

BSD license is permissive; you can use, modify, and distribute this package with minimal restrictions, provided you retain the license notice.

Quickstart

import json
from jsonconversion.encoder import JSONObjectEncoder
from jsonconversion.decoder import JSONObjectDecoder

var = (1, 2, 3)
str_var = json.dumps(var, cls=JSONObjectEncoder)
var_2 = json.loads(str_var, cls=JSONObjectDecoder)
assert var == var_2

Requires Python 3.9 or later; numpy is a runtime dependency.

Verify before relying

  • Whether numpy array serialization is fully documented or tested in the current release.
  • Performance characteristics when serializing deeply nested or very large object graphs.
  • Compatibility guarantees with recent Python 3.x minor versions beyond 3.9.

Package facts

License BSD (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 1 — numpy
Maintenance aging — 275 days since the last release
Last repo commit
First released
Downloads 14,088,461/month — #1,247 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: jsonconversion-1.2.1-py3-none-any.whl

Keywords: json, conversion, serialization

Development Status :: 5 - Production/StableFramework :: DjangoFramework :: FlaskIntended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: Science/ResearchLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: Python :: 2Programming Language :: Python :: 3Topic :: Internet :: WWW/HTTPTopic :: Scientific/Engineering :: Interface Engine/Protocol TranslatorTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Object BrokeringTopic :: Utilities

Tags

json serialization custom objectspython object to json conversionjson encoder decoder numpyserialize arbitrary python classesjson with custom type support
serializationjson-encoding

More Python Modules packages