Skip to main content

jsondate3-aware

Sick of rewriting the same JSON datetime handling code for each project? jsondate3-aware is a drop-in replacement for Python’s standard json library that adds sensible handling of datetime and date objects.

jsondate3-aware uses ISO8601 for encoding datetime objects and the date-specific part of ISO6801 for encoding date objects.

It:

  • supports Python 2 and 3

  • creates timezone-aware datetime objects when able

  • supports JavaScript-style dates (datetime.datetime(%Y, %m, %d, %H, %M, %S))

Example:

import datetime
import jsondate3 as json

>>> data = json.dumps(dict(created_at=datetime.datetime(2012, 10, 31)))
'{"created_at": "2012-10-31T00:00:00Z"}'

>>> json.loads(data)
{u'created_at': datetime.datetime(2012, 10, 31, 0, 0, tzinfo=datetime.timezone.utc)}

>>> date = json.dumps(dict(date=datetime.date(2012, 10, 31)))
'{"date": "2012-10-31"}'

>>> json.loads(data)
{u'created_at': datetime.date(2012, 10, 31)}

Testing

Run them with:

python -m unittest tests.test_jsondate

Deployment

If you wish to create a new version manually, the process is:

  1. Update version info in setup.py

  2. Install the requirements in requirements_dev.txt

  3. Set up a config file at ~/.pypirc

  4. Generate a universal distribution that worksin py2 and py3 (see setup.cfg)

    rm -r dist &&  python setup.py sdist bdist_wheel
  5. Upload the distributions

    twine upload dist/* -r pypi (or pypitest)

Metadata

Release files for jsondate3-aware 0.2.1

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

Source distribution (sdist)

Source distribution for jsondate3-aware 0.2.1
File Size Uploaded Provenance Actions
jsondate3-aware-0.2.1.tar.gz 5.0 kB Without provenance Details for jsondate3-aware-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jsondate3-aware 0.2.1
File Interpreter ABI Platform Actions
jsondate3_aware-0.2.1-py2.py3-none-any.whl Python 2, Python 3 none any Details for jsondate3_aware-0.2.1-py2.py3-none-any.whl

Total release size: 10.5 kB

Release files / jsondate3-aware-0.2.1.tar.gz

Download URL jsondate3-aware-0.2.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0e21392083a8e65a3a375cd6f72c49e49b41d2738695c11a4504eb5a4636f39b
BLAKE2b-256 checksum
How to use checksums
91184fe0b05eea81f33b98e369d2e6204659872cd33ddf3506c00f6a2fe0e00f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/2.7.18rc1

Release files / jsondate3_aware-0.2.1-py2.py3-none-any.whl

Download URL jsondate3_aware-0.2.1-py2.py3-none-any.whl
Size 5.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ebb4c2be55b9c832e94267116ef1bb5f1523bb6b8fddc0cc453153b8d0da74cb
BLAKE2b-256 checksum
How to use checksums
57a1ceabe75e91ebc3d5a66c8a23cb4412b0676a4706359a5517e526c5b269c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/2.7.18rc1

Security for jsondate3-aware 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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