Skip to main content

json with datetimes and custom types

Project description

JSON plus types

Uses builtin json. but adds a lookup dictionary with functions that encode/decode specific types.


$ pip install jsonplustypes

default _TYPE_FUNCS dict holds:

datetime.datetime: encode_datetime,
"DATETIME": decode_datetime,

where encode ande decode datetime functions:

def encode_datetime(date_object):
date_string = datetime.datetime.strftime(date_object, _DATE_FORMAT)
return {

def decode_datetime(date_string):
return datetime.datetime.strptime(date_string, _DATE_FORMAT)

the github repo holds a reference javascript implementation of the same json serialization/deserialization

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 jsonplustypes, version 0.5
Filename, size File type Python version Upload date Hashes
Filename, size jsonplustypes-0.5.tar.gz (1.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page