https://github.com/russellluo/jsonsir
A serializer for JSON-like data in Python.
https://github.com/russellluo/jsonsir
Last synced: 12 months ago
JSON representation
A serializer for JSON-like data in Python.
- Host: GitHub
- URL: https://github.com/russellluo/jsonsir
- Owner: RussellLuo
- Created: 2014-11-20T02:48:55.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-01-16T11:07:59.000Z (over 11 years ago)
- Last Synced: 2025-03-17T18:05:20.487Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 168 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
JsonSir
=======
A serializer for JSON-like data in Python.
Serialization Rules
-------------------
### Serializing
Convert Python data to JSON:
Value in Python | Value in JSON | Value in JSON (`WITH_TYPE_NAME` == True)
----------------------------------------- | -------------------------- | --------------------------
10 | 10 | 10
True | true | true
"string" | "string" | "string"
re._pattern_type | "/russ/" | "regex(/russ/)"
bson.ObjectId("543934671d41c812802711f3") | "543934671d41c812802711f3" | "objectid(543934671d41c812802711f3)"
datetime.datetime(2014, 10, 11) | "2014-10-11T00:00:00Z" | "datetime(2014-10-11T00:00:00Z)"
### Deserializing
Convert JSON data to Python:
Value in JSON | Value in Python
------------------------------------ | -----------------------------------------
"int(10)" | 10
"bool(true)" | True
"string" | "string"
"regex(/russ/)" | re._pattern_type
"objectid(543934671d41c812802711f3)" | bson.ObjectId("543934671d41c812802711f3")
"datetime(2014-10-11T00:00:00Z)" | datetime.datetime(2014, 10, 11)