json5
A Python implementation of the JSON5 data format.
Decision gist · record as of 2026-08-14
Yes, if you need to parse or generate JSON5 documents and can tolerate the performance penalty. The package is permissively licensed, has no dependencies, and is actively maintained. Install it only if JSON5 syntax is a genuine requirement; for standard JSON, use the built-in json module instead.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- None; the package has no runtime dependencies and requires only Python 3.8 or later.
- Low install friction with no runtime dependencies.
- Actively maintained as of June 2026 with recent bug fixes and dependency updates.
License · maintenance · safety
permissive license (permissive) — Licensed under Apache 2.0 (permissive). Benchmark files carry separate MIT licenses. No restrictions on commercial use or modification.
last release 2026-06-19 (56 days) · last repo commit 2026-06-24 · 283 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 56,835,055 downloads/mo, #524 on PyPI
Alternatives
Verify before relying
import json5
# Parse JSON5 with comments and unquoted keys
data = json5.loads("""{
// This is a comment
name: 'example',
items: [1, 2, 3,], // trailing comma
}""")
# Write back as JSON5
output = json5.dumps(data, indent=2)- Whether performance penalty is acceptable for your use case (documented as 1000–6000x slower than standard JSON).
- Compatibility with custom JSONDecoder/JSONEncoder subclasses (not supported; see known issues).
What it is and what it does
json5 is a Python implementation of the JSON5 data format, which relaxes JSON syntax to make it more usable as a configuration language. It reads and writes JSON5 documents with support for JavaScript-style comments (single and multi-line), unquoted object keys, trailing commas in objects and arrays, and single-quoted or multi-line strings. The API mirrors Python's standard json module for ease of use, with one notable addition: an optional allow_duplicate_keys parameter to reject duplicate object keys.
The package has no runtime dependencies and supports Python 3.8 and later. It is actively maintained but carries a significant performance trade-off: it is documented as 1000–6000x slower than the C-optimized JSON module and 200x slower than pure Python json. This makes it suitable for configuration parsing and one-off data interchange tasks, but not for high-throughput or latency-sensitive workloads.
Use it for
- Parse configuration files that use JSON5 syntax with comments and relaxed formatting.
- Convert JSON5 documents to Python objects and back, maintaining JSON5 syntax on write.
- Validate and reject JSON5 documents with duplicate object keys using allow_duplicate_keys=False.
- Migrate from JavaScript-based JSON5 tooling to Python while preserving JSON5 document semantics.
- Encode custom Python objects to JSON5 using the JSON5Encoder class with custom encode() methods.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to parse or generate JSON5 documents and can tolerate the performance penalty.
The package is permissively licensed, has no dependencies, and is actively maintained. Install it only if JSON5 syntax is a genuine requirement; for standard JSON, use the built-in json module instead.
Install
json5 on PyPI
Before you install
Low install friction with no runtime dependencies. Actively maintained as of June 2026 with recent bug fixes and dependency updates. Performance is a documented limitation: the package is 1000–6000x slower than the C-optimized JSON module.
None; the package has no runtime dependencies and requires only Python 3.8 or later.
License in practice
Licensed under Apache 2.0 (permissive). Benchmark files carry separate MIT licenses. No restrictions on commercial use or modification.
Quickstart
import json5
# Parse JSON5 with comments and unquoted keys
data = json5.loads("""{
// This is a comment
name: 'example',
items: [1, 2, 3,], // trailing comma
}""")
# Write back as JSON5
output = json5.dumps(data, indent=2)
Verify before relying
- Whether performance penalty is acceptable for your use case (documented as 1000–6000x slower than standard JSON).
- Compatibility with custom JSONDecoder/JSONEncoder subclasses (not supported; see known issues).
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.8.0 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 56 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 56,835,055 / month, #524 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: json5-0.15.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “parse json5 format”
- json5Parses and writes JSON5 data format, which extends JSON with…
- pyjson5Parses and serializes JSON5 (a more lenient JSON variant) and…
- json-fiveParses and serializes JSON5 (an extended JSON format with comments,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Text Processing packages
A drop-in replacement for Python's standard `re` module that adds advanced regex features like nested sets, fuzzy matching, lookaround in conditionals, and full Unicode case-folding while maintaining backward compatibility.
pyparsing provides a library for building text parsers directly in Python code using composable grammar classes, handling quoted strings, whitespace variation, and embedded comments without regex or lex/yacc.
Install it if you need to parse text or define grammars programmatically.
fonttools manipulates font files in multiple formats (TrueType, OpenType, AFM, Type 1, Mac-specific) and includes TTX, a tool to convert fonts to and from XML text format.
Install it if you need to read, write, or manipulate fonts programmatically or via the TTX command-line tool.
Docutils converts plaintext documentation in reStructuredText format into multiple output formats including HTML, XML, and LaTeX using a modular processing system.
RapidFuzz provides fast fuzzy string matching using Levenshtein Distance and related metrics, implemented mostly in C++ with Python bindings for rapid similarity scoring and approximate string matching.
Install it if you need fuzzy string matching; it's a solid replacement for FuzzyWuzzy with better licensing and performance.
tinycss2 parses CSS strings into token and block objects, and generates CSS strings from those objects, following the CSS Syntax Level 3 specification without enforcing specific properties or values.
Install it if your project requires CSS tokenization or syntax manipulation.
See also chompjs · json-five · json5kit · perky · pyjson5 · jsonconversion · partialjson · json-with-comments · jstyleson · ndjson