partialjson
Parse incomplete or partial json
What it is and what it does
Partialjson is a lightweight Python library for extracting structured data from incomplete or truncated JSON strings—a common problem when parsing streaming responses or interrupted data feeds. It recovers valid Python objects from JSON that is missing closing brackets, trailing commas, or other incomplete syntax, without requiring the full payload to be available upfront.
The library offers two parsing modes: strict (default) for standard JSON, and lenient (strict=False) for handling embedded newlines. It also supports JSON5 syntax (comments, unquoted keys, single quotes, trailing commas) when the optional json5 dependency is installed. With zero runtime dependencies in the base package and a simple three-line API, it integrates easily into projects that consume streaming or partially-buffered JSON data.
Use it for:
- Parse streaming JSON responses from language models or APIs that send data incrementally before the full payload is complete.
- Recover structured data from log files or network captures where JSON is truncated or interrupted mid-transmission.
- Handle JSON5 configuration files with comments and unquoted keys in development tooling or build systems.
- Extract partial results from real-time data pipelines where downstream consumers need to work with incomplete structures.
- Debug and inspect malformed JSON payloads during development without manual string repair.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses incomplete or malformed JSON strings into valid Python objects, handling truncated structures and optional JSON5 syntax extensions.
Yes. The package solves a real problem—parsing incomplete JSON—with minimal overhead and no dependencies. Active maintenance, permissive MIT license, and a clean API make it a low-risk addition to projects that consume streaming or interrupted JSON data. Not needed for standard, complete JSON parsing.
Install
partialjson on PyPI
pip
pip install partialjsonuv
uv add partialjsonpoetry
poetry add partialjsonInstalling partialjson
Before you install
Low friction—pure Python wheel with no runtime dependencies. Active maintenance with recent commits and a modest but steady user base.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open and proprietary projects.
Quickstart
from partialjson import JSONParser
parser = JSONParser()
incomplete_json = '{"name": "John", "age": 30, "items": [1, 2'
result = parser.parse(incomplete_json)
print(result) # {'name': 'John', 'age': 30, 'items': [1, 2]}
Verify before relying
- Whether strict=False mode handles all edge cases with embedded newlines reliably
- Performance characteristics on very large incomplete JSON payloads
- Exact JSON5 feature coverage when json5 optional dependency is installed
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 176 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 596,611/month — #5,839 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: partialjson-1.1.0-py3-none-any.whl
Tags
More Text Processing packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyparsingpyparsing provides a library for building text…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
RapidFuzzRapidFuzz provides fast fuzzy string matching…
permissive · top 1,000 on PyPI
tinycss2tinycss2 parses CSS strings into token and…
permissive · top 1,000 on PyPI
llama-parseLlamaParse parses complex documents (PDFs,…
permissive · top 1,000 on PyPI
jiterA fast JSON parser that converts bytes into…
permissive · top 1,000 on PyPI
partial-json-parserParses incomplete JSON strings generated by LLM…
permissive · top 5,000 on PyPI
json5Parses and writes JSON5 data format, which…
permissive · top 1,000 on PyPI
pyjson5Parses and serializes JSON5 (a more lenient…
permissive · top 5,000 on PyPI
json5kitParses JSON5 (JSON with comments, trailing…
permissive · top 15,000 on PyPI
streamingjsonCompletes partial JSON strings into…
permissive · top 15,000 on PyPI
fix-busted-jsonRepairs malformed JSON strings by fixing common…
permissive · top 15,000 on PyPI
json-repairParses and repairs malformed JSON strings from…
permissive · top 1,000 on PyPI
hjsonParses and generates Hjson (a human-friendly…
permissive · top 5,000 on PyPI
chompjsParses JavaScript objects embedded in HTML or…
permissive · top 15,000 on PyPI