json-tricks
Extra features for Python's JSON: comments, order, numpy, pandas, datetimes, and many more! Simple but customizable.
Decision gist · record as of 2026-08-14
Yes. Low install friction, no runtime dependencies, permissive Revised BSD License, active maintenance, and no known vulnerabilities make it a safe choice. Install it if you need to serialize non-standard Python types to JSON; skip it if you only work with standard JSON types.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Optional dependencies (numpy, pandas, pytz) must be installed separately to serialize those specific types.
- Low friction install with no runtime dependencies.
- Actively maintained as of 2026-08-08, with 162 GitHub stars and a stable release history since 2015-11-07.
License · maintenance · safety
permissive license (permissive) — Permissive Revised BSD License allows use in commercial and private projects with minimal restrictions.
last release 2023-08-19 (1091 days) · last repo commit 2026-08-08 · 162 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 204,981 downloads/mo, #9,595 on PyPI
Alternatives
Verify before relying
pip install json-tricks
from json_tricks import dumps, loads, dump, load, strip_comments
json_str = dumps({'data': [1, 2, 3]})
recovered = loads(json_str)- Performance characteristics when serializing very large arrays or deeply nested class hierarchies.
- Current status of pull request and issue handling on the repository.
What it is and what it does
json-tricks extends Python's standard json module to serialize and deserialize types that the standard library cannot handle natively. It lets you store arrays in readable format with dtype and shape metadata, save class instances with their module and attribute state, preserve datetime and timezone information as dictionaries, maintain OrderedDict insertion order, and include comments in JSON files by prefixing lines with `#`. Each special type uses a magic key (like `__ndarray__`, `__instance_type__`, `__datetime__`) to signal its type during deserialization.
The package is designed for cases where you need JSON's portability and human readability but work with Python-specific data structures. It supports optional compression for arrays and allows custom serialization via `__json_encode__` and `__json_decode__` methods on your classes. Most features work out of the box, though some require optional dependencies to be installed separately.
Use it for
- Save arrays to JSON for data interchange while keeping the format human-readable and portable.
- Serialize Python class instances to JSON for configuration files or inter-process communication.
- Store datetime and timezone information in JSON without losing precision or context.
- Preserve dictionary insertion order in JSON files when round-tripping through Python versions.
- Add comments to JSON configuration files for documentation without breaking JSON parsing.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Low install friction, no runtime dependencies, permissive Revised BSD License, active maintenance, and no known vulnerabilities make it a safe choice. Install it if you need to serialize non-standard Python types to JSON; skip it if you only work with standard JSON types.
Install
json-tricks on PyPI
Before you install
Low friction install with no runtime dependencies. Actively maintained as of 2026-08-08, with 162 GitHub stars and a stable release history since 2015-11-07.
Optional dependencies (numpy, pandas, pytz) must be installed separately to serialize those specific types.
License in practice
Permissive Revised BSD License allows use in commercial and private projects with minimal restrictions.
Quickstart
pip install json-tricks
from json_tricks import dumps, loads, dump, load, strip_comments
json_str = dumps({'data': [1, 2, 3]})
recovered = loads(json_str)
Verify before relying
- Performance characteristics when serializing very large arrays or deeply nested class hierarchies.
- Current status of pull request and issue handling on the repository.
Package facts
| License | permissive license permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 1,091 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 204,981 / month, #9,595 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableDevelopment Status :: 6 - MatureIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python Modules |
Evidence: json_tricks-3.17.3-py2.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 › “serialize class instances json”
- json-tricksExtends Python's JSON serialization to handle numpy arrays, class…
- dataclasses-json-speakeasyConverts Python dataclasses to and from JSON with a decorator or…
- marshmallow-sqlalchemyGenerates marshmallow schemas from SQLAlchemy models to serialize and…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also json-with-comments · json-numpy · json-encoder · typing-json · hjson · numpyencoder · phpserialize · jsonconversion · json-repair · json-timeseries