Skip to main content

JSON encoder that aims to be fully compliant with specifications ECMA-262 and ECMA-404.

Project description

https://badge.fury.io/py/standardjson.png https://travis-ci.org/audreyr/standardjson.png?branch=master https://pypip.in/d/standardjson/badge.png

JSON encoder fully compliant with the ECMA-262 and ECMA-404 specifications.

Features

Support for all objects that the Python stdlib’s json.JSONEncoder can encode, plus:

  • datetime.datetime

  • datetime.date

  • datetime.time

  • decimal.Decimal

Works on Python 2.6, 2.7, 3.3. Probably works on 3.4 and 3.5 but I haven’t set up tests for those with Tox yet.

Quickstart

Use StandardJSONEncoder as you would use json.JSONEncoder from the Python standard library:

>>> import datetime
>>> import json
>>> from standardjson import StandardJSONEncoder

>>> json.dumps({'day': datetime.date(2010, 2, 17)}, cls=StandardJSONEncoder)
'{"day": "2010-02-17"}'

History

0.3.1 (2014-05-21)

  • Full rename to standardjson (missed some files in 0.3.0).

0.3.0 (2014-05-21)

  • Rename package to standardjson.

  • StandardJSONEncoder is now in encoders module.

  • Encoder functions are now in encoder_funcs module.

0.2.0 (2014-05-20)

  • Full implementation with tests.

  • Separate encoders module for encoder functions.

  • Bump to Alpha.

0.1.0 (2014-05-18)

  • First release on PyPI.

Project details


Download files

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

Source Distribution

standardjson-0.3.1.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

standardjson-0.3.1-py2.py3-none-any.whl (4.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file standardjson-0.3.1.tar.gz.

File metadata

File hashes

Hashes for standardjson-0.3.1.tar.gz
Algorithm Hash digest
SHA256 71b7b0a649d5e3bd343a02737e752c054c218242dcaa739abab98086e537fbab
MD5 0b4003c352bd1f8678fc518b26d8b4dc
BLAKE2b-256 eec9fec85650e7364a2d9ad4f0ae8a1a8356e9bc0754c22a9eb5b0bd42d80d8a

See more details on using hashes here.

File details

Details for the file standardjson-0.3.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for standardjson-0.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 69e79b090d3f7dd887ae4a9db226ea79cd3fd3d7cfa8491d23ec6b06126e24b0
MD5 50803699e8749c4850cbb2b888dfec1a
BLAKE2b-256 71aa0e895a29171f8163a426ce69f012c66d72c9c2499d31ba2e8a393985d08e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page