Skip to main content

jsondate

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

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

Example:

import datetime
import jsondate 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)}

>>> 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)}

Unicode Empty Strings

The json standard library module will return unicode objects for all strings except empty strings, which are returned as str objects.

This inconsistency can be annoying when using libraries that expect all input to be unicode.

jsondate fixes this by returning empty-strings as unicode objects as well.

Metadata

Release files for jsondate 0.1.2

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

Source distribution (sdist)

Source distribution for jsondate 0.1.2
File Size Uploaded Provenance
jsondate-0.1.2.tar.gz 3.5 kB Without provenance Details

Release files / jsondate-0.1.2.tar.gz

Download URL jsondate-0.1.2.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7ecc7144ae207c72fcf73b1563e1762e38404ea9f069ec7f50f0f5dc59f23f7e
BLAKE2b-256 checksum
How to use checksums
31683289811a68f56478ffd1cf790f875e01c00c1abd941d5c9459d5cd7beaf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for jsondate 0.1.2

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.

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