{"categories":[{"label":"Software Development","url":"https://skillfed.io/packages/category/software-development/15"}],"enrichment":{"capability":"Patches Python's built-in `json` module to recognize and call a `__json__` method on custom classes during serialization, similar to JavaScript's `toJSON`.","skillfed_tags":["json-serialization","monkey-patching"],"use_cases":["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."],"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\u2014instead of forking their code or catching exceptions, you simply define the serialization logic in your class.\n\nThe 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.","worth_installing":"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\u2014install it only if the `__json__` pattern solves a specific serialization problem you face."},"id":"json-fix","links":{"html":"https://skillfed.io/packages/json-fix","md":"https://skillfed.io/packages/json-fix.md","pypi":"https://pypi.org/project/json-fix/"},"maintenance":{"status":"aging"},"meta":{"latest_release":"2025-10-23","license_spdx":null,"license_treatment":"permissive","name":"json-fix","python_support":"supports_current","summary":"allow custom class json behavior on builtin json object"},"popularity":{"monthly_downloads":136129,"position":11405,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"1.0.2"}
