json-queries
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-queries
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
# executing within docker
```docker build -t json-queries .``` To build the image
```docker run --name json-queries -it json-queries``` To run a new container instance of the image
```docker start json-queries``` To run the container, if it is stopped
```docker exec -it json-queries ipython --profile=template``` Open an Ipython session in a running container
# utils
```docker images -a | tail -n +2 | wc -l``` Count the total number of docker images
Metadata
Release files for json-queries 0.1.16
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| json-queries-0.1.16.tar.gz | 56.5 kB | Without provenance | Details for json-queries-0.1.16.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| json_queries-0.1.16-py3-none-any.whl | Python 3 | none | any | Details for json_queries-0.1.16-py3-none-any.whl |
Total release size: 119.3 kB
Release files / json-queries-0.1.16.tar.gz
| Download URL | json-queries-0.1.16.tar.gz |
|---|---|
| Size | 56.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1e147be85f748ae1bcdc51a085d560f99e0276841b3f62c61967e1ea5ba87b40
|
|
BLAKE2b-256 checksum How to use checksums |
a15505d8d382e14fd20be2bcf03778724616b0376db476f4d295ff746430ffd5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Release files / json_queries-0.1.16-py3-none-any.whl
| Download URL | json_queries-0.1.16-py3-none-any.whl |
|---|---|
| Size | 62.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6efc2f7230a872566a1144e4246998128f21ed4c72644e557b530256c635cba2
|
|
BLAKE2b-256 checksum How to use checksums |
576720c51f02202701419167649bc07b9b00d32317d5663b76cc5d3b469d909d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Security for json-queries 0.1.16
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.