skillfed

partialjson

Parse incomplete or partial json

partialjson v1.1.0 596.6K downloads/30d#5,839 on PyPI101
Permissive license MIT Active released

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 partialjson

uv

uv add partialjson

poetry

poetry add partialjson

Installing 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

parse incomplete jsonpartial json parsertruncated json handlingjson parsing with missing bracketsstreaming json parserjson5 supportmalformed json recovery
json-parsingstreaming-dataerror-recovery

More Text Processing packages