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.10.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for json_repr-1.1.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 776f25fd41e0f62622470d6cc8ace57658c03792f0b16ea970f47fbe748d9e37 |
|
MD5 | b763bb66184b0373a921ff165264d3ab |
|
BLAKE2b-256 | 0495e9b4814627bb0a55bcfacb5e870e76fcd209769c3ba285a541d1cf009153 |