Handle JSON like data structures with a "repr(...)" fallback, e.g. for MongoDB types
Project description
json-repr
Pretty print JSON like data structures with a "repr(...)" fallback, e.g. for MongoDB types
Usage
import json_repr
# JSON: Legacy Mongo Shell Format
original_source = """{
"_id" : ObjectId("507f1f77bcf86cd799439011"),
"persons": [
{
"name": "Alice",
"id": NumberInt(1)
},
{
"name": "Bob",
"id": NumberInt(2)
}
]
}"""
document = json_repr.eval_mongo_db_json(original_source)
print(document.persons[0])
dumped_source = json_repr.dumps(document)
print(dumped_source)
print(dumped_source == original_source)
MongoDB
Currently supported (legacy) mongo shell types:
- ObjectId
- NumberInt
- NumberLong
- NumberDecimal
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
json_repr-1.1.9.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for json_repr-1.1.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 653b98066b61ba0fde881ce4d1b33a10fa3cd43826d341e9980397e2603fc830 |
|
MD5 | fa849641bd79f498993bc1542ee878ba |
|
BLAKE2b-256 | bcabc67a5fda65b1303028392fdfb1f9dcf61f9400140ae1612acfa0ee17b7a5 |