Skip to main content

PyPI-Status PyPI-Versions Build-Status Codecov LICENCE

morejson is a drop-in replacement for Python’s json that handles additional built-in Python types.

import morejson as json
import datetime

json.dumps({'now': datetime.datetime.now()})
json.dumps({'set': set([1,2]), 'complex': complex(32, -4)})

1 Installation

Install morejson with:

pip install morejson

2 Use

morejson implements the exact same API as Python’s built-in json module; the dump, dumps, load and loads methods wrap around their json counterparts without changing their interface, while any other function or attribute is left unchanged.

You can use any argument of these methods, including default, cls and object_hook; morejson will wrap around any kind of custom behaviour you provide, giving it priority over morejson’s encoding or decoding, and allowing you to use it with any custom JSON encoding/decoding code you have.

3 Supported Types

3.1 Built-in Types

  • set

  • frozenset

  • complex

3.2 datetime module types

  • date

  • time

  • datetime

  • timedelta

  • timezone

4 Contributing

Package author and current maintainer is Shay Palachy (shay.palachy@gmail.com); You are more than welcome to approach him for help. Contributions are very welcomed.

4.1 Installing for development

Clone:

git clone git@github.com:shaypal5/morejson.git

Install in development mode with test dependencies:

cd morejson
pip install -e ".[test]"

4.2 Running the tests

To run the tests, use:

nosetests --cover-erase --with-coverage --cover-package=morejson -d

4.3 Adding documentation

This project is documented using the numpy docstring conventions, which were chosen as they are perhaps the most widely-spread conventions that are both supported by common tools such as Sphinx and result in human-readable docstrings (in my personal opinion, of course). When documenting code you add to this project, please follow these conventions.

5 Credits

Created by Shay Palachy (shay.palachy@gmail.com).

Inspired by a great Github gist by abhinav-upadhyay: https://gist.github.com/abhinav-upadhyay/5300137

Release files for morejson 1.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for morejson 1.1.5
File Size Uploaded
morejson-1.1.5.tar.gz 21.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for morejson 1.1.5
File Interpreter ABI Platform
morejson-1.1.5-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 30.2 kB

Release files / morejson-1.1.5.tar.gz

Download URL morejson-1.1.5.tar.gz
Size 21.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d7e05028a1faafd0af85cf285d4b4643abfcac971e1e8b3ef720853541bdc996
BLAKE2b-256 checksum
How to use checksums
a2584997b1f615e7cfd0f045b0050c87aa33fc952b5fa3209b1822f4b70ab1e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / morejson-1.1.5-py2.py3-none-any.whl

Download URL morejson-1.1.5-py2.py3-none-any.whl
Size 8.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
482fbf70f8d75f8f8a7f772522a34ec006b4febb39ab990b57ed741328d9ed7a
BLAKE2b-256 checksum
How to use checksums
5d7d97c20d6f72abd309368140db0ff5e7804a9c44de6160faa2cdbd55fba59a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.1.5 This release

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page