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 details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file json_repr-1.1.9.tar.gz.
File metadata
- Download URL: json_repr-1.1.9.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 |
122d7354a8d1c2e5db4d2ec590fc8035e320c26cc2ed91fa883284e9baa02648
|
|
| MD5 |
cd23ace5b8cb778765020810c1ae4f04
|
|
| BLAKE2b-256 |
8f1328130bf6c4a788894500dab83efef4bcd57af091c523073bb036861bc5af
|
File details
Details for the file json_repr-1.1.9-py3-none-any.whl.
File metadata
- Download URL: json_repr-1.1.9-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 |
653b98066b61ba0fde881ce4d1b33a10fa3cd43826d341e9980397e2603fc830
|
|
| MD5 |
fa849641bd79f498993bc1542ee878ba
|
|
| BLAKE2b-256 |
bcabc67a5fda65b1303028392fdfb1f9dcf61f9400140ae1612acfa0ee17b7a5
|