skillfed

json-with-comments

JSON with Comments (jsonc) for Python

json-with-comments v1.2.10 136.9K downloads/30d#11,381 on PyPI19
Permissive license MIT Active released

What it is and what it does

json-with-comments is a Python library that extends JSON parsing to handle comments and trailing commas—features common in configuration files but not part of the JSON specification. It provides load/loads functions that strip single-line (//) and block (/* */) comments before parsing, and dump/dumps functions that can add comments and trailing commas when serializing.

The package has no external dependencies and supports Python 3.7 through 3.13 on both CPython and PyPy. Use it when you need to read or write JSON-like configuration files that include comments, or when working with JSONC format commonly found in configuration tools.

Use it for:

  • Parse configuration files in JSONC format that include comments and trailing commas.
  • Strip comments from JSON during a preprocessing step before passing to strict JSON parsers.
  • Serialize Python objects to JSON while preserving or adding explanatory comments for readability.
  • Handle hand-edited JSON files that developers have annotated with trailing commas and comments.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Parses and serializes JSON with support for single-line and block comments, plus trailing commas in arrays and objects.

Yes. The package is actively maintained, has no dependencies, installs easily, carries a permissive MIT license, and solves a real problem for anyone working with JSONC files or commented JSON. No known vulnerabilities. Install it if you need to parse or generate JSON with comments.

Install

json-with-comments on PyPI

pip

pip install json-with-comments

uv

uv add json-with-comments

poetry

poetry add json-with-comments

Installing json-with-comments

Before you install

Low friction: pure Python wheel, no runtime dependencies, and actively maintained with a recent commit on 2026-08-07.

License in practice

MIT license is permissive; you can use this package freely in commercial and private projects with minimal restrictions.

Quickstart

pip install json-with-comments

import json_with_comments
result = json_with_comments.loads('{"key": "value" /* comment */}')
print(result)

Verify before relying

  • Whether dump/dumps comment-addition features work with arbitrary Python objects or only specific types.
  • Performance characteristics when parsing large JSON files with extensive comments.
  • How the module's import name relates to the package name json-with-comments.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 612 days since the last release
Last repo commit
First released
Downloads 136,908/month — #11,381 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: json_with_comments-1.2.10-py3-none-any.whl

Keywords: json with comments, jsonc

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python Modules

Tags

json with comments parserjsonc pythonjson comments supporttrailing commas jsonstrip comments from jsonjson comment removal
json-parsingconfiguration

More Python Modules packages