json-fix
allow custom class json behavior on builtin json object
Decision gist · record as of 2026-08-14
Yes, if you need to customize JSON serialization for classes you control or intercept serialization of third-party objects. The package has low install friction, no dependencies, and a permissive MIT license. However, the aging maintenance status (295 days since last release) suggests limited active development—install it only if the `__json__` pattern solves a specific serialization problem you face.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.6 or later; json_fix must be imported before json.dumps is called on objects you want to serialize.
- Low install friction with no runtime dependencies.
- Maintenance status is aging—last release was 295 days ago, though the repository remains active and not archived.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions; you must include a copy of the license and copyright notice.
last release 2025-10-23 (295 days) · last repo commit 2025-10-23 · 26 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 136,129 downloads/mo, #11,405 on PyPI
Alternatives
Verify before relying
pip install json-fix
import json_fix
import json
class MyClass:
def __json__(self):
return self.__dict__
obj = MyClass()
print(json.dumps(obj))- Whether the override_table's last-entry-wins priority behavior is reliable across all Python versions.
- Performance impact when using large override_table or fallback_table dictionaries with many checker functions.
- Real-world adoption and whether the aging maintenance status indicates the package is stable or abandoned.
What it is and what it does
json-fix is a lightweight patch to Python's built-in `json` module that enables custom serialization behavior for user-defined classes. When you import it, it modifies `json.dumps()` to recognize and call a `__json__()` method on any object, allowing you to define how your class should be converted to JSON-compatible types. This solves the problem of third-party code attempting to serialize your objects without knowing how to handle them—instead of forking their code or catching exceptions, you simply define the serialization logic in your class.
The package provides two mechanisms for controlling serialization: an `override_table` for intercepting specific classes before they check for a `__json__` method, and a `fallback_table` for providing default serialization when neither a `__json__` method nor an override rule exists. Both tables use checker functions as keys, prioritizing the most recently added entry. The patch is described as safe, backwards-compatible, and reversible.
Use it for
- Enable JSON serialization of custom classes without modifying their definition or the calling code that uses json.dumps().
- Intercept serialization of third-party library objects by adding override rules without forking the library.
- Provide a fallback serialization strategy for all objects with a `__dict__` attribute, making arbitrary Python classes JSON-serializable by default.
- Migrate codebases that rely on toJSON() patterns to Python while preserving the same serialization approach.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to customize JSON serialization for classes you control or intercept serialization of third-party objects.
The package has low install friction, no dependencies, and a permissive MIT license. However, the aging maintenance status (295 days since last release) suggests limited active development—install it only if the `__json__` pattern solves a specific serialization problem you face.
Install
json-fix on PyPI
Before you install
Low install friction with no runtime dependencies. Maintenance status is aging—last release was 295 days ago, though the repository remains active and not archived.
Requires Python 3.6 or later; json_fix must be imported before json.dumps is called on objects you want to serialize.
License in practice
MIT license permits commercial and private use with minimal restrictions; you must include a copy of the license and copyright notice.
Quickstart
pip install json-fix
import json_fix
import json
class MyClass:
def __json__(self):
return self.__dict__
obj = MyClass()
print(json.dumps(obj))
Verify before relying
- Whether the override_table's last-entry-wins priority behavior is reliable across all Python versions.
- Performance impact when using large override_table or fallback_table dictionaries with many checker functions.
- Real-world adoption and whether the aging maintenance status indicates the package is stable or abandoned.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.6 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Aging 295 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 136,129 / month, #11,405 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: json_fix-1.0.2-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “custom json serialization”
- json-fixPatches Python's built-in `json` module to recognize and call a…
- json-encoderProvides JSON serialization with singledispatch-based type handlers…
- jsonconversionConverts arbitrary Python objects to JSON strings and back, extending…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also jsonable · jsonconversion · json-encoder · orjson · simplejson · jsons · json-numpy · phpserialize · munch · pyion2json