skillfed

json-five

A JSON5 parser that, among other features, supports round-trip preservation of comments

json-five v1.1.2 143.9K downloads/30d#11,165 on PyPI39
Permissive license Apache Active released

What it is and what it does

json-five is a JSON5 parser and serializer for Python that extends standard JSON handling to support JSON5—a relaxed JSON format allowing comments, unquoted object keys, trailing commas, and other conveniences. It provides two main interfaces: a simple loads/dumps API mirroring the standard library's json module, and a lower-level abstract model API for advanced use cases like linting, formatting, and custom serialization.

The package is designed to preserve non-data elements (comments, formatting, identifier styles) during round-trip operations, so you can load JSON5, modify it programmatically, and dump it back while keeping the original structure intact. It depends on sly and regex and is actively maintained with support for Python 3.8 through 3.11.

Use it for:

  • Load configuration files written in JSON5 format with comments and relaxed syntax into Python dictionaries.
  • Build linters or formatters that parse JSON5 and preserve comments and formatting during output.
  • Edit JSON5 documents programmatically using the abstract model API while maintaining original comments and structure.
  • Tokenize JSON5 input for custom analysis or validation workflows.
  • Work with JSON5 documents that use unquoted identifiers and other relaxed syntax features.

Worth the install?

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

Parses and serializes JSON5 (an extended JSON format with comments, unquoted keys, and trailing commas) with an interface similar to Python's standard json module, plus support for round-trip preservation of comments and formatting.

Yes. The package is actively maintained, has low install friction, carries a permissive Apache license, and fills a genuine gap for JSON5 support in Python. It is well-suited for configuration parsing and round-trip editing. The abstract model API is marked unstable, so avoid it if you need long-term compatibility guarantees, but the core loads/dumps interface is stable as of v1.0.0.

Install

json-five on PyPI

pip

pip install json-five

uv

uv add json-five

poetry

poetry add json-five

Installing json-five

Before you install

Low friction: pure Python wheel, two lightweight runtime dependencies (sly and regex), and active maintenance with a recent commit on 2026-07-27. Supports Python 3.8 and later versions.

License in practice

Apache License (permissive): you can use this package in commercial and private projects without restriction, though you must include a copy of the license and state any modifications.

Quickstart

pip install json-five

import json5
json_text = '{foo: "bar"}  // comment'
data = json5.loads(json_text)
print(data)

Requires Python 3.8 or later; the import name is json5, not json_five.

Verify before relying

  • Performance characteristics when parsing large JSON5 files or deeply nested structures.
  • Stability guarantees for the abstract model API beyond v1.0.0 (marked subject to breaking changes in minor releases).
  • Real-world usage patterns and community feedback on the model-based loader for linting and formatting workflows.

Package facts

License Apache (permissive)
Python support supports the current Python release (>=3.8.0)
Install friction low — pure-Python wheel
Runtime dependencies 2 — sly, regex
Maintenance actively maintained — 794 days since the last release
Last repo commit
First released
Downloads 143,860/month — #11,165 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: json_five-1.1.2-py3-none-any.whl

License :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

json5 parser pythonparse json with commentsjson5 loader serializerpreserve comments jsonunquoted keys json parserround-trip json editingjson5 format support
json-parserconfiguration-formatcomment-preservation

More Text Processing packages