Translates Django ORM query system to json objects
Project description
json-enhanced
Nowadays, communication between API infrastructures commonly uses JSON data.
This library aims to emulate the behavior of the Django ORM, exporting such functionality to JSON objects.
Installation
pip install json-enhanced
Simple case of use
>> import jsonutils as js
from datetime import datetime
>> json_data = js.JSONObject(
{
"data": [
{
"name": "Dan",
"birthday": "1991-01-02 09:00:00",
"publications": 15
},
{
"name": "Mar",
"birthday": "1991-03-02 12:30:00",
"publications": 13
},
{
"name": "Carl",
"birthday": "1950-06-02 16:00:00",
"publications": 36
},
{
"name": "Vic",
"birthday": "1986-07-02 16:00:00",
"publications": None
},
]
}
)
# now we can navegate through this object by attribute accesion
>> json_data.data._1.name
'Mar'
# or we can make queries as django's ORM
>> result = json_data.query(birthday__lt=datetime(1985,1,1))
>> result
<QuerySet ['1950-06-02 16:00:00']>
>> result.first().parent
{'name': 'Carl', 'birthday': '1950-06-02 16:00:00', 'publications': 36}
# retrieving the path of a node object
>> result.first().jsonpath
data/2/
# testing environment
We have developed a Docker container with all the configuration options, modules and variables already setted up, so that you can test the behaviour of the package, just by typing:
```bash build.sh```
Then, on Ipython terminal, you can access `test` variable with some json data, or create new a JSONObject
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-enhanced-0.1.1.tar.gz
(24.3 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-enhanced-0.1.1.tar.gz.
File metadata
- Download URL: json-enhanced-0.1.1.tar.gz
- Upload date:
- Size: 24.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e3d3b303809d7d74cfac390b9cd08ec8683c0951256b49d59ab200218a14da6
|
|
| MD5 |
e2f64c3ade6523766a9118b1dbea9fa8
|
|
| BLAKE2b-256 |
abd6efd6775c326c21eeb918ffbcbc0d887633842d53312dc679696009ca838e
|
File details
Details for the file json_enhanced-0.1.1-py3-none-any.whl.
File metadata
- Download URL: json_enhanced-0.1.1-py3-none-any.whl
- Upload date:
- Size: 25.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c11631bfb7cf2b37f2281de57f9d8000c68118174a70c3cc64bd28a969129d8
|
|
| MD5 |
06f61364ba469cf67b0d755c0b5c568a
|
|
| BLAKE2b-256 |
5102a6806bfe1d71b4e4a57da0cb33944e5446d06c6c95bf9299ae209d2913fa
|