jsoncomment
A wrapper to JSON parsers allowing comments, multiline strings and trailing commas
What it is and what it does
jsoncomment is a preprocessor wrapper that extends any JSON parser (including the standard library's json module) to accept comments, multiline strings, and trailing commas—features that standard JSON does not allow. It works by stripping comments and normalizing syntax before passing the cleaned input to your chosen JSON parser's load() or loads() methods.
The package supports single-line comments using #, ;, or //, multiline comments with /* */, and triple-quoted multiline strings similar to Python. It also provides convenience methods like loadf() to load JSON files with a fallback default value and dumpf() to save JSON with indentation. However, the project has been abandoned since 2019-02-08 with no active maintenance, which means it will not receive updates for compatibility with newer Python versions or security issues.
Use it for:
- Load configuration files that contain comments and trailing commas without manual preprocessing
- Parse JSON-like data formats in legacy systems or custom file formats that tolerate relaxed JSON syntax
- Preprocess JSON strings in scripts where you want to add inline documentation without breaking parsing
- Work with existing codebases already using jsoncomment where replacement is not feasible
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses JSON with comments, multiline strings, and trailing commas by preprocessing input before passing it to any standard JSON parser.
No. While the package is permissive (MIT) and has low install friction, it is abandoned (last release 2019-02-08) with no active maintenance. For new projects, use a maintained alternative. For legacy systems already using jsoncomment, it may continue to work on Python 3.3+, but you assume all maintenance risk and will receive no security updates.
Install
jsoncomment on PyPI
pip
pip install jsoncommentuv
uv add jsoncommentpoetry
poetry add jsoncommentInstalling jsoncomment
Before you install
Low install friction as a pure-Python wheel with one runtime dependency (json-spec). However, the package is abandoned—last release was 2019-02-08. No active maintenance or security updates.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions, making it safe from a licensing perspective.
Quickstart
pip install jsoncomment
from jsoncomment import JsonComment
json = JsonComment()
json_obj = json.loads('[1, 2, 3,] # trailing comma')
Requires Python 3.3 or later. Comments must be preceded only by whitespace on the same line; inline comments are not supported.
Verify before relying
- Whether json-spec dependency is actively maintained and compatible with current Python versions
- Real-world compatibility with modern JSON parsers beyond the standard library json module
- Whether the package works reliably with modern Python versions despite being marked abandoned since 2019-02-08
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.3) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — json-spec |
| Maintenance | abandoned — 2,744 days since the last release |
| First released | |
| Downloads | 136,149/month — #11,403 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: jsoncomment-0.4.2-py3-none-any.whl
Keywords: json, comments, multiline
Tags
More Pre-processors packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
asttokensAnnotates Python abstract syntax trees with the…
permissive · top 1,000 on PyPI
progressbar2progressbar2 renders text-based progress bars…
permissive · top 5,000 on PyPI
jusTextjusText removes boilerplate content…
permissive · top 5,000 on PyPI
shtabGenerates shell tab completion scripts for…
copyleft · top 5,000 on PyPI
jsminMinifies JavaScript code by removing…
permissive · top 5,000 on PyPI
comment-parserExtracts comments from source code files across…
permissive · top 15,000 on PyPI
jcConverts output from popular CLI tools,…
permissive · top 15,000 on PyPI
json-with-commentsParses and serializes JSON with support for…
permissive · top 15,000 on PyPI
jstylesonParses JSON strings that contain…
permissive · top 15,000 on PyPI
json5kitParses JSON5 (JSON with comments, trailing…
permissive · top 15,000 on PyPI
commented-configparserExtends Python's standard ConfigParser to…
permissive · top 15,000 on PyPI
json-repairParses and repairs malformed JSON strings from…
permissive · top 1,000 on PyPI
add-trailing-commaAutomatically adds trailing commas to…
permissive · top 15,000 on PyPI
jsonc-parserParses JSON files with comments (.jsonc) and…
permissive · top 15,000 on PyPI
poyoParses a restricted subset of YAML into Python…
permissive · top 15,000 on PyPI