AI JSON Fixer
Extract and fix JSON from mixed LLM output — handles prose, markdown, and concatenation.
Aggressive JSON extraction and repair for LLM outputs that mix JSON with prose, markdown, or multiple objects. Finds the first { or [ in the text, extracts to the matching closer (handling full nesting), then applies all standard repairs: markdown fence stripping, trailing comma removal, single-to-double quote conversion, key quoting, bracket balancing, and comment removal. Handles concatenated top-level objects by wrapping them in an array.
Related Tools
Fix broken LLM JSON: strip markdown fences, trailing commas, single quotes, and more.
Visually build JSON schemas for AI function calling and structured output.
Validate AI JSON output against a JSON Schema — check types, required fields, enums.
Parse and pretty-print SSE stream chunks from OpenAI and similar APIs.
Generate a structured output prompt from a JSON example or schema.
Learn More
FAQ
- How does the JSON extraction work?
- The tool scans the input text for the first { or [ character, then walks forward tracking nesting depth to find the matching } or ]. Everything between those positions is extracted as the JSON candidate, which is then repaired and parsed.
- What happens if the model output contains multiple JSON objects?
- If multiple top-level { } objects are detected in the input (concatenated without separators), the tool wraps them in a JSON array [ ... ] so the output is valid JSON. This handles the common case of models outputting object after object.
- When should I use JSON Fixer vs JSON Repair?
- Use JSON Repair when your input is already mostly JSON with minor syntax errors. Use JSON Fixer when the model output is a longer message that contains JSON embedded in prose, or when there are multiple JSON blobs concatenated together.