skillfed

json-source-map

Calculate the source map for a JSON document.

json-source-map v1.0.5 374.0K downloads/30d#7,151 on PyPI23
Permissive license DORMANT released

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-map

uv

uv add json-source-map

poetry

poetry add json-source-map

Installing 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

Development Status :: 5 - Production/StableLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: DisassemblersTopic :: Software Development :: DocumentationTopic :: Text ProcessingTopic :: UtilitiesTyping :: Typed

Tags

json source location mappingjson pointer with line columnjson error position trackingjson document source mapjson value location finderjson parse position tracking
json-parsingsource-mappingerror-reporting

More Utilities packages