partial-json-parser
Parse partial JSON generated by LLM
Decision gist · record as of 2026-08-14
Yes. This is a specialized, well-maintained tool with zero dependencies, permissive licensing, and a clear use case in modern LLM-streaming workflows. The active maintenance, recent releases, and top-5000 PyPI position indicate real adoption. Install if you're building applications that stream structured JSON from language models.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.6 or later.
- Zero runtime dependencies and pure Python implementation make installation frictionless.
- Active maintenance with recent releases; last commit 2026-04-22 and latest release 2025-11-17 indicate ongoing support.
License · maintenance · safety
MIT (permissive) — MIT license is permissive, allowing use in commercial and proprietary projects with minimal restrictions.
last release 2025-11-17 (270 days) · last repo commit 2026-04-22 · 137 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 6,367,402 downloads/mo, #1,920 on PyPI
Alternatives
Verify before relying
pip install partial-json-parser
from partial_json_parser import loads
result = loads('{"key": "v') # Returns: {'key': 'v'}
# Or complete the JSON string:
from partial_json_parser import ensure_json
completed = ensure_json('{"key": "v') # Returns: '{"key": "v"}'- Performance characteristics when parsing very large incomplete JSON structures.
- Behavior with deeply nested or complex partial JSON edge cases beyond the documented examples.
What it is and what it does
partial-json-parser handles a specific problem in LLM integration: when streaming JSON responses token-by-token, the JSON is incomplete until the final token arrives, making standard JSON parsing fail. This library extracts and returns whatever valid data it can from incomplete JSON, and can also complete partial JSON strings to valid syntax so they parse cleanly.
The parser works like the standard json.loads when given complete JSON, but accepts an optional `allow_partial` parameter (bitwise flags from the `Allow` enum) to specify which data types are permitted to be incomplete—strings, numbers, arrays, objects, booleans, null, or special values like NaN and Infinity. By default it allows all partial types. It has zero runtime dependencies, is implemented in pure Python, and includes type hints.
Use it for
- Stream structured data from LLM APIs (OpenAI, Anthropic, etc.) and display partial results to users as tokens arrive.
- Extract valid JSON objects from incomplete LLM responses mid-generation without waiting for completion.
- Build chat interfaces that show structured data (like JSON-formatted lists or tables) incrementally as the model generates them.
- Parse and validate JSON from sources that may truncate or cut off mid-response, recovering what data is available.
- Debug or inspect malformed JSON by attempting to extract the maximum valid structure before the error point.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is a specialized, well-maintained tool with zero dependencies, permissive licensing, and a clear use case in modern LLM-streaming workflows. The active maintenance, recent releases, and top-5000 PyPI position indicate real adoption. Install if you're building applications that stream structured JSON from language models.
Install
partial-json-parser on PyPI
Before you install
Zero runtime dependencies and pure Python implementation make installation frictionless. Active maintenance with recent releases; last commit 2026-04-22 and latest release 2025-11-17 indicate ongoing support.
Requires Python 3.6 or later.
License in practice
MIT license is permissive, allowing use in commercial and proprietary projects with minimal restrictions.
Quickstart
pip install partial-json-parser
from partial_json_parser import loads
result = loads('{"key": "v') # Returns: {'key': 'v'}
# Or complete the JSON string:
from partial_json_parser import ensure_json
completed = ensure_json('{"key": "v') # Returns: '{"key": "v"}'
Verify before relying
- Performance characteristics when parsing very large incomplete JSON structures.
- Behavior with deeply nested or complex partial JSON edge cases beyond the documented examples.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.6 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 270 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 6,367,402 / month, #1,920 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 :: Developers |
Evidence: partial_json_parser-0.2.1.1.post7-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 incomplete json”
- partial-json-parserParses incomplete JSON strings generated by LLM streaming, extracting…
- partialjsonParses incomplete or malformed JSON strings into valid Python…
- streamingjsonCompletes partial JSON strings into syntactically valid JSON by…
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 json-repair · langdiff · partialjson · streamingjson · jiter · dirtyjson · fix-busted-json · json-five · instructor · prefixdate