Skip to main content

json with datetime and more, KISS

Project description

JSON plus types

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

default _TYPE_FUNCS dict holds:

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

where encode ande decode datetime functions:

def encode_datetime(date_object):
timestamp = int(1000 * time.mktime(date_object.utctimetuple()))
return {

def decode_datetime(timestamp):
return datetime.datetime.utcfromtimestamp(timestamp/1000)

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

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page