JsonSourceMap
Calculate JSON Pointers to each value within a JSON document along with the line, column and character position for the start and end of that value. For more information see: https://github.com/open-alchemy/json-source-map/wiki.
For example:
python -m pip install json_source_map
from json_source_map import calculate
print(calculate('{"foo": "bar"}'))
The above prints:
{
'': Entry(
value_start=Location(line=0, column=0, position=0),
value_end=Location(line=0, column=14, position=14),
key_start=None,
key_end=None,
),
'/foo': Entry(
value_start=Location(line=0, column=8, position=8),
value_end=Location(line=0, column=13, position=13),
key_start=Location(line=0, column=1, position=1),
key_end=Location(line=0, column=6, position=6),
),
}
Where:
- each key in the dictionary is a JSON path to an item,
- each value in the dictionarty contains the mapping of the item at the JSON
path which have the following properties:
value_startis the start of the value,value_endis the end of the value,key_startis the start of the key (which isNoneat the root level and for array items),key_endis the end of the key (which isNoneat the root level and for array items) and
- each of the above have the following properties:
lineis the zero-indexed line position,columnis the zero-indexed column position andpositionis the zero-indexed character position in the string (independent of the line and column).
The following features have been implemented:
- support for primitive types (
strings,numbers,booleansandnull), - support for structural types (
arrayandobject) and - support for space, tab, carriage and return whitespace.
Metadata
Release files for json-source-map 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| json_source_map-1.0.5.tar.gz | 6.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| json_source_map-1.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.1 kB
Release files / json_source_map-1.0.5.tar.gz
| Download URL | json_source_map-1.0.5.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de99103c0637707368eb888d7aaa82bad1e21dbe2d21813998caabaa7c2e52f9
|
|
BLAKE2b-256 checksum How to use checksums |
e6f0560df0f36ad3e6c1e9b2a077a297df2c4dc4a2c427580d1995782aff67d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.16
|
Release files / json_source_map-1.0.5-py3-none-any.whl
| Download URL | json_source_map-1.0.5-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c8ddb8db76dc238fce485abb548e5c7fc2b44d5ae8efb766e90e7c15840afaca
|
|
BLAKE2b-256 checksum How to use checksums |
2f5cbdddb48cf521428117bd1338c531c0027f1c32beba23c89f9713229fe17c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.16
|