json with iso datetimes and custom types
Project description
Uses builtin json. but adds a lookup dictionary with functions that encode/decode specific types.
TO INSTALL
$ pip install jsonplustypes
by default it is able to:
encode dat
by default it is able to:
* encode datetime,date and bson ObjectId's to and from
custom TYPE/VALUE dict
* dump with float precision if you want to cut off digits
Custom objects are encoded in the following verbose dict format (with datetime as example):
{
_TYPE_TAG:"DATETIME",
_VALUE_TAG:date_string
}
the github repo holds a reference javascript implementation of the same json serialization/deserialization
CHANGELOG:
==========
0.7.7
fixed so now uses str(type(obj).__name__)
0.7.6:
now loads and dumps iso datetime strings with the format:
"%Y-%m-%dT%H:%M:%S.%fZ"
0.7.5:
fixed the strange float precision limiter
not based on monkeypatching the json.encoder.FLOAT_REPR and json.encoder.c_make_encoder, which means it now runs without the C speedups
0.7:
added encoder for datetime.date and bson ObjectId
0.6:
fixed bug - JSONEncoder -> json.JSONEncoder
TO INSTALL
$ pip install jsonplustypes
by default it is able to:
encode dat
by default it is able to:
* encode datetime,date and bson ObjectId's to and from
custom TYPE/VALUE dict
* dump with float precision if you want to cut off digits
Custom objects are encoded in the following verbose dict format (with datetime as example):
{
_TYPE_TAG:"DATETIME",
_VALUE_TAG:date_string
}
the github repo holds a reference javascript implementation of the same json serialization/deserialization
CHANGELOG:
==========
0.7.7
fixed so now uses str(type(obj).__name__)
0.7.6:
now loads and dumps iso datetime strings with the format:
"%Y-%m-%dT%H:%M:%S.%fZ"
0.7.5:
fixed the strange float precision limiter
not based on monkeypatching the json.encoder.FLOAT_REPR and json.encoder.c_make_encoder, which means it now runs without the C speedups
0.7:
added encoder for datetime.date and bson ObjectId
0.6:
fixed bug - JSONEncoder -> json.JSONEncoder
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jsonplustypes-0.7.7.tar.gz
(2.3 kB
view details)
File details
Details for the file jsonplustypes-0.7.7.tar.gz.
File metadata
- Download URL: jsonplustypes-0.7.7.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08ebba12020556d6541b877f10f79491333dc7664efed219c0d20c584fadb30b
|
|
| MD5 |
4cc6c507fcf2ebb88c37816fad5fe667
|
|
| BLAKE2b-256 |
e5880c139dc96da85188c609b829fa3fa42d829e2de1b88686a7558d8135595c
|