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 details)
Built Distribution
File details
Details for the file json_repr-1.1.10.tar.gz
.
File metadata
- Download URL: json_repr-1.1.10.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9089bb44e79b43c58f5c564fdcf18ef3916da8f9e53b28c32ff7bf329b0fecef |
|
MD5 | fac4944862031576dbe03eb288f5d8d0 |
|
BLAKE2b-256 | 7605e4ad3d6e9550904f93d93aacb155c726555ad3c60f1ef847a8d8c8922c04 |
File details
Details for the file json_repr-1.1.10-py3-none-any.whl
.
File metadata
- Download URL: json_repr-1.1.10-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 776f25fd41e0f62622470d6cc8ace57658c03792f0b16ea970f47fbe748d9e37 |
|
MD5 | b763bb66184b0373a921ff165264d3ab |
|
BLAKE2b-256 | 0495e9b4814627bb0a55bcfacb5e870e76fcd209769c3ba285a541d1cf009153 |