JsonNode Implementation
This drb-driver-json module implements json format access with DRB data
model. It is able to navigates among the json contents.
Json Factory and Json Node
The module implements the basic factory model defined in DRB in its node resolver. Based on the python entry point mechanism, this module can be dynamically imported into applications.
The entry point group reference is drb.driver.
The driver name is json.
The factory class JsonNodeFactory is encoded into drb.drivers.json.factory.
The json factory creates a JsonNode from an existing json content. It uses a base node to access the content data using the streamed base node implementation.
The base node can be a FileNode (See drb), HttpNode, ZipNode or
any other node able to provide streamed (BufferedIOBase, RawIOBase, IO)
json content.
limitations
The current version does not manage child modification and insertion. JsonNode is currently read only.
Using this module
To include this module into your project, the drb-driver-json module shall be
referenced into requirement.txt file, or the following pip line can be run:
pip install drb-driver-json
Node Creation:
The driver can create a JsonNode by giving the path to a json file:
from drb.drivers.json import JsonNode
node = JsonNode(PATH_JSON)
the driver can also give a dictionary in argument:
from drb.drivers.json import JsonNode
DICT = {
"id":"01",
"name": "Tom",
"lastname": "Price"
}
node = JsonNode(NAME_OF_YOUR_NODE, data = DICT)
If the baseNode is an HttpNode, FileNode... the driver can retrieve the data of your Json with this:
from drb.drivers.json import JsonNodeFactory
FACTORY = JsonNodeFactory()
FILE_NODE = DrbFileNode(PATH_TO_YOUR_JSON)
NODE = FACTORY.create(FILE_NODE)
Different types of data
| data | JSON Type | Python Type |
|---|---|---|
| null | null | None |
| true/false | boolean | bool |
| 'hello World' | string | str |
| 1 | int | int |
| 1.0 | number | float |
| [...] | array | list |
| {...} | object | dict |
Documentation
The documentation of this driver can be found here https://drb-python.gitlab.io/impl/json
Release files for drb-driver-json 1.3.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| drb_driver_json-1.3.8.tar.gz | 30.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| drb_driver_json-1.3.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.6 kB
Release files / drb_driver_json-1.3.8.tar.gz
| Download URL | drb_driver_json-1.3.8.tar.gz |
|---|---|
| Size | 30.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
250acf55789807734c5f80338909b9ce95fc9dd3a03dcd4dababe7294e401c65
|
|
BLAKE2b-256 checksum How to use checksums |
0073c48f51a453fabf80aed1f1f27522b2b55cb952a96ba9b7c5675d7a52f934
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / drb_driver_json-1.3.8-py3-none-any.whl
| Download URL | drb_driver_json-1.3.8-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
18fd08daa138743fbc25b8d823a4cb0ab1e67859f6fb85437542408f43643007
|
|
BLAKE2b-256 checksum How to use checksums |
8d1b76e3f8d25ea2e0ffc0e17e4c2cfee8f3a3b27a40a73238e7f1c1f935fe1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|