skillfed

jsonpickle

jsonpickle encodes/decodes any Python object to/from JSON

jsonpickle v4.1.2 20.9M downloads/30d#1,025 on PyPI1,318
Permissive license BSD-3-Clause Active released

What it is and what it does

jsonpickle is a serialization library that converts Python objects into JSON format and back again. Unlike Python's built-in pickle module, which produces binary output readable only by Python, jsonpickle generates human-readable JSON that can be indexed and processed by non-Python tools. It handles both simple types and complex structures like numpy arrays and pandas DataFrames through optional registered handlers.

The library sits between pickle's power and JSON's portability: it preserves Python object types and state in a text format suitable for storage, transmission, and cross-platform inspection. However, it carries the same security model as pickle—deserialization can execute arbitrary code, so it should only be used with trusted data sources.

Use it for:

  • Serialize machine learning models and numpy arrays to JSON for storage in cloud systems where they can be indexed by query tools.
  • Export pandas DataFrames to a human-readable JSON format that remains machine-processable across different platforms and languages.
  • Convert complex Python objects to JSON for REST API responses or inter-service communication while preserving type information.
  • Store application state or configuration objects as JSON files that can be inspected and debugged without running Python code.
  • Migrate data from pickle-based systems to JSON for better tooling support and auditability in data pipelines.

Worth the install?

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

jsonpickle converts complex Python objects to and from JSON, enabling human-readable serialization of data structures including numpy arrays and pandas DataFrames.

Yes, if you need to serialize complex Python objects to JSON and control the data source. The library is stable, actively maintained, has no external dependencies, and solves a real gap between pickle and standard JSON. However, treat deserialization of untrusted data as a security risk equivalent to pickle—only deserialize data you control or have verified. For untrusted input, read JSON directly without object reconstruction.

Install

jsonpickle on PyPI

pip

pip install jsonpickle

uv

uv add jsonpickle

poetry

poetry add jsonpickle

Installing jsonpickle

Before you install

Installation is straightforward with no runtime dependencies beyond Python stdlib. The package is actively maintained with a recent release 78 days ago and has 1318 repository stars, indicating stable ongoing support.

License in practice

Licensed under BSD-3-Clause (permissive), allowing commercial and private use with minimal restrictions—you must include the license notice but face no copyleft obligations.

Quickstart

pip install jsonpickle

import jsonpickle
from dataclasses import dataclass

@dataclass
class Example:
    data: str

ex = Example("value1")
encoded_instance = jsonpickle.encode(ex)
decoded_instance = jsonpickle.decode(encoded_instance)

Only deserialize data from trusted sources; jsonpickle can execute arbitrary Python code during unpickling, just like the stdlib pickle module.

Verify before relying

  • Whether the numpy and pandas extensions require those libraries to be installed separately or are optional at runtime
  • Performance characteristics when serializing very large or deeply nested object graphs
  • Compatibility guarantees with third-party pickle protocols or custom __getstate__/__setstate__ implementations

Package facts

License BSD-3-Clause (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 78 days since the last release
Last repo commit
First released
Downloads 20,874,719/month — #1,025 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: jsonpickle-4.1.2-py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: Only

Tags

python object to json serializationserialize complex python objectsjson encoding decoding pythonpickle alternative json formatnumpy pandas json serializationhuman readable python serializationcross platform object serialization
serializationjsondata-interchange

More Utilities packages