json-source-map
Calculate the source map for a JSON document.
What it is and what it does
json-source-map is a Python library that parses JSON and produces a detailed source map: for each value in the document, it records the JSON Pointer path to that value and its precise location in the source text (line, column, and character position for both the key and value). This is useful when you need to report errors or warnings tied to specific parts of a JSON file and want to tell users exactly where to look.
The library handles all JSON types—primitives (strings, numbers, booleans, null) and structures (arrays, objects)—and tracks whitespace correctly. It returns a dictionary mapping JSON Pointer paths to Entry objects, each containing start and end locations with line, column, and character position. No external runtime dependencies are required.
Use it for:
- Report validation errors in JSON files with exact line and column numbers for user-friendly error messages.
- Build JSON linters or formatters that need to map diagnostics back to source positions.
- Implement JSON-aware code editors or IDEs that highlight specific values or keys.
- Debug JSON parsing issues by correlating parsed values with their exact source locations.
- Generate source maps for JSON-to-code transpilers or code generators.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Maps each value in a JSON document to its source location (line, column, character position) and JSON Pointer path, enabling precise error reporting and source-aware JSON processing.
Yes, if you need precise source location tracking for JSON values. The package is stable, has zero dependencies, and works on current Python versions. The dormant maintenance status is a minor concern only if you expect future Python compatibility issues; for current use (Python 3.8–3.11), it is reliable and ready to use.
Install
json-source-map on PyPI
pip
pip install json-source-mapuv
uv add json-source-mappoetry
poetry add json-source-mapInstalling json-source-map
Before you install
Low install friction with no runtime dependencies. Maintenance is dormant—last release was 2022-12-20 and last commit 2024-01-01—but the package is marked Production/Stable and supports current Python versions (3.8–3.11).
License in practice
Licensed under Apache Software License (permissive), allowing free use, modification, and distribution with minimal restrictions.
Quickstart
from json_source_map import calculate
result = calculate('{"foo": "bar"}')
print(result) # Maps JSON paths to Entry objects with value_start, value_end, key_start, key_end locations
Verify before relying
- Whether dormant maintenance status poses a risk for future Python version compatibility or bug fixes.
- Performance characteristics on large JSON documents (memory usage, parsing speed).
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.8,<4.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 1,333 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 373,985/month — #7,151 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: json_source_map-1.0.5-py3-none-any.whl
Keywords: Python, JSON, source map
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
dirtyjsonParses JSON-like data from files containing…
permissive · top 5,000 on PyPI
jsonpointerResolves JSON Pointers according to RFC 6901,…
permissive · top 1,000 on PyPI
flatten-jsonConverts nested JSON objects into flat…
permissive · top 5,000 on PyPI
sqlalchemy-jsonProvides mutation-tracked JSON column types for…
permissive · top 5,000 on PyPI
referencingResolves JSON references according to JSON…
permissive · top 100 on PyPI
jsonmergeMerges multiple JSON documents into a single…
permissive · top 5,000 on PyPI
json-specImplements JSON Schema, JSON Pointer, and JSON…
permissive · top 15,000 on PyPI
jschonValidates JSON data against JSON Schema (drafts…
permissive · top 15,000 on PyPI
jsonslicerParses JSON streams and large files without…
permissive · top 15,000 on PyPI
chompjsParses JavaScript objects embedded in HTML or…
permissive · top 15,000 on PyPI