Calculate the source map for a JSON document.
Project description
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),
),
}
The following features have been implemented:
- support for primitive types (
strings
,numbers
,booleans
andnull
), - support for structural types (
array
andobject
) and - support for space, tab, carriage and return whitespace.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
json_source_map-1.0.2.tar.gz
(6.2 kB
view hashes)
Built Distribution
Close
Hashes for json_source_map-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 290a685fe7750cdacea0d5002438231b388ff50cfb1efcec3ed7ebfff719b90d |
|
MD5 | 4aa0bade9390847603eb334ff24f0356 |
|
BLAKE2b-256 | 9bc8f9c3c5f7ad12a3f37da8406a64dc6c2e4015f91630f632c96dc30b7c023a |