Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

For serializing Python objects to JSON (dicts) and back

Project description

PyPI version Documentation Status Build Status Code Coverage Scrutinizer Code Quality Maintainability

   _ ___  ___  _ __  ___
  | / __|/ _ \| '_ \/ __|
  | \__ | (_) | | | \__ \
  | |___/\___/|_| |_|___/
|__/      MADE EASY!

~ Any Python objects to/from JSON, easily! ~

  • Python 3.5+
  • Minimal effort to use!
  • No magic, just you, Python and jsons!
  • Human readible JSON without pollution!
  • Easily customizable and extendable!
  • Type hints for the win!

Example of a model to be serialized:

class Person:
    name: str
    birthday: datetime

Example of the serialization:

jsons.dump(Person('Guido van Rossum', birthday_guido))

Output after serialization:

{'birthday': '1956-01-31T12:00:00Z', 'name': 'Guido van Rossum'}


pip install jsons


import jsons

some_instance = jsons.load(some_dict, SomeClass)  # Deserialization
some_dict = jsons.dump(some_instance)  # Serialization

In some cases, you have instances that contain other instances that need (de)serialization, for instance with lists or dicts. You can use the typing classes for this as is demonstrated below.

from typing import List, Tuple
import jsons

# For more complex deserialization with generic types, use the typing module
list_of_tuples = jsons.load(some_dict, List[Tuple[AClass, AnotherClass]])

(For more examples, see the FAQ)


Recent updates


  • Feature: Support for Deque.
  • Feature: Support for Counter.
  • Feature: Support for OrderedDict.
  • Feature: Support for Defaultdict.
  • Feature: Support for ChainMap.


  • Feature: Support for textual type hints.
  • Feature: Automatically announce classes when dumped.
  • Bugfix: Support for from __future__ import annotations


  • Bugfix: Loading verbose dumped objects could fail if lists where involved.


  • Bugfix: Dumping a namedtuple resulted in a list rather than a dict.
  • Feature: Loading into named tuples can be from lists and dicts.


  • Bugfix: Loading a verbose dump worked only shallow.


Special thanks to the following contributors:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for jsons, version 0.8.5
Filename, size File type Python version Upload date Hashes
Filename, size jsons-0.8.5-py3-none-any.whl (34.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size jsons-0.8.5.tar.gz (24.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page