Registry / serialization / json-source-map

json-source-map

JSON →
library1.0.5pypypi✓ verified 80d ago

Calculate the source map for a JSON document, mapping JSON values to their exact source locations (line, column, path). Version 1.0.5 supports Python 3.8-3.11. Low activity; last release March 2022.

pip install json-source-map
INSTALL
IMPORT
SIG · JSON-SOURCE-MAP
J
json-source-map
serializationpythonv1.0.5
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

advance
from json_source_map import advance
from json_source_map import locate
calculate
from json_source_map import calculate
check
from json_source_map import check

Parses a JSON string and returns source map for each key/value.

import json from json_source_map import locate json_str = '{"key": "value"}' data = json.loads(json_str) result = locate(data, json_str) print(result['key'])
Debug
Known issues
gotchaThe `locate` function transforms the JSON data. The returned dict contains source map objects, not the original values. To access original values, use the keys from the input data.
fix
Access the source map via `result['key'].value` or iterate over original data keys.
affects: all
gotchaThe `locate` function expects a JSON string as second argument. Passing a file object or bytes will raise a TypeError.
fix
Always pass a string. For bytes, decode first: `json_str = file_obj.read().decode('utf-8')`.
affects: all
deprecatedPython 3.7 support was dropped in v1.0.3. Installing on Python 3.7 will get v1.0.2 or fail.
fix
Upgrade to Python 3.8+ or pin to json-source-map==1.0.2.
affects: >=1.0.3
Upgrade
Version history
1.0.5latest on PyPI · released Dec 20, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
json-source-map — pip install json-source-map · libregistry