--- id: pyjson5 version: "2.0.1" license: MIT OR Apache-2.0 license_treatment: permissive maintenance: active --- # pyjson5 — JSON5 serializer and parser for Python 3 written in Cython. License: permissive · Maintenance: active · Downloads: 2.8M/mo ## What it is and what it does pyjson5 is a JSON5 parser and serializer written in Cython for Python 3. JSON5 is a more permissive variant of JSON that allows unquoted keys, trailing commas, comments, and other relaxations of strict JSON syntax. The library also handles standard JSON, making it a potential drop-in replacement for Python's built-in json module. The serializer produces ASCII output with apostrophes, ampersands, and angle brackets encoded as Unicode escapes, making it safe for direct use in HTML templates without additional escaping. The parser handles all valid JSON5 1.0.0 and JSON data. The package has no runtime dependencies and supports Python 3.8 through 3.14, including recent CPython free-threading beta support. Use it for: - Parse configuration files in JSON5 format that allow comments and unquoted keys - Serialize Python objects to JSON for embedding directly in HTML templates without HTML-escaping vulnerabilities - Handle JSON data with trailing commas or other JSON5 relaxations from external sources - Replace the standard json module when lenient parsing of JSON-like input is needed - Generate JSON output safe for use in JavaScript contexts within web pages ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parses and serializes JSON5 (a more lenient JSON variant) and standard JSON in Python, with output safe for HTML templates. Yes. The package is actively maintained, production-stable, has no dependencies, supports current Python versions, carries no known vulnerabilities, and solves a real problem—parsing lenient JSON5 and generating HTML-safe JSON output. Install it if you need JSON5 support or HTML-safe serialization; otherwise the standard json module suffices. ## Install pip install pyjson5 uv add pyjson5 poetry add pyjson5 ## Installing pyjson5 Before you install: Medium install friction due to compiled wheels; actively maintained with recent commits and stable production status. No runtime dependencies simplifies deployment. License in practice: Dual-licensed under MIT or Apache-2.0 (permissive); you may choose either license for your use, with no restrictions on commercial or proprietary projects. Quickstart: pip install pyjson5 import pyjson5 data = pyjson5.loads('{a: 1, b: 2}') # Parse JSON5 result = pyjson5.dumps(data) # Serialize to JSON Requires Python 3.8 or later; CPython 3.8+ or recent PyPy3 version needed. Verify before relying: - Performance characteristics compared to standard json module for typical workloads - Specific nesting depth limit before 'absurdly high' threshold is reached - Whether HTML-safe escaping is applied by default or requires explicit configuration ## Package facts - License: MIT OR Apache-2.0 (permissive) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 2.8M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags json5 parser python, json5 serializer, lenient json parsing, json5 encoder decoder, html-safe json serialization, json5 cython, parse json5 format, json5, html-safe-serialization, cython-compiled [View on SkillFed](https://skillfed.io/packages/pyjson5) · [View on PyPI](https://pypi.org/project/pyjson5/)