--- id: json5kit version: "0.4.0" license: MIT license_treatment: permissive maintenance: dormant --- # json5kit — A Roundtrip parser and CST for JSON, JSONC and JSON5. License: permissive · Maintenance: dormant · Downloads: 88.1K/mo ## What it is and what it does json5kit is a parser and code transformer for JSON5—a JSON superset that allows comments, trailing commas, unquoted object keys, and single-quoted strings. It builds a concrete syntax tree (CST) that preserves the original source structure, so you can parse JSON5, modify it programmatically, and convert it back to source while keeping comments and formatting intact, or export it as standard JSON. The package has no runtime dependencies and supports Python 3.7 and later. It provides a visitor pattern for tree traversal and transformation, letting you inspect and modify parsed values while maintaining the source representation. This is useful for configuration files, build scripts, or any JSON-like format where readability and comments matter. Use it for: - Parse and edit configuration files written in JSON5 while preserving user comments and formatting - Convert JSON5 config files to standard JSON for consumption by tools that only accept strict JSON - Build linters or formatters for JSON5 that need to understand and modify the syntax tree - Programmatically transform JSON5 data structures using visitor patterns without losing source fidelity - Support JSONC (JSON with comments) in applications that currently expect strict JSON ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parses JSON5 (JSON with comments, trailing commas, unquoted keys) into a concrete syntax tree and converts it back to source or standard JSON while preserving formatting and comments. Yes, if you need to parse JSON5 or JSONC and preserve formatting or comments. The package is stable and has no dependencies, making it low-risk to add. However, maintenance is dormant (no updates since May 2023), so if you hit edge cases or need new JSON5 features, you may need to fork or patch it yourself. ## Install pip install json5kit uv add json5kit poetry add json5kit ## Installing json5kit Before you install: Low friction; no runtime dependencies. Maintenance is dormant (last release May 2023, last commit October 2023), so expect no active bug fixes or feature updates. License in practice: MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions. Quickstart: pip install json5kit import json5kit source = '{items: [1, 2, 4], // comment}' tree = json5kit.parse(source) print(tree.to_source()) # preserves formatting print(tree.to_json()) # standard JSON output Verify before relying: - Extent of JSON5 syntax coverage beyond comments, trailing commas, and unquoted keys - Performance characteristics on large files or deeply nested structures - Whether transformer API supports all node types or only a subset ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 88.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags json5 parser, parse json with comments, roundtrip json parser, concrete syntax tree json, json5 to json converter, jsonc parser, preserve json formatting, json-parser, cst, roundtrip [View on SkillFed](https://skillfed.io/packages/json5kit) · [View on PyPI](https://pypi.org/project/json5kit/)