DevKits

LLM JSON Extractor (Pull JSON out of ChatGPT / Claude replies)

Extract every JSON object or array buried inside an LLM reply — even when it's wrapped in markdown fences, mixed with explanation text, or has trailing commas and single quotes. Auto-repairs each block. 100% local.

Last updated:

Comments

Paste a full ChatGPT or Claude reply into the box above and every JSON object or array inside it is pulled out and cleaned automatically — markdown fences stripped, trailing commas and single quotes fixed. Nothing is uploaded.

266 chars · 11 lines
[
0:{
"id":1
"name":"Alice"
"role":"admin"
}
1:{
"id":2
"name":"Bob"
"role":"user"
}
]

Extracted 2 JSON blocks(some needed repair — trailing commas, single quotes, etc.)

What is LLM JSON Extractor?

LLMs almost never return clean, parseable JSON. Even when you ask for JSON, the model wraps it in a ```json code fence, prefixes it with 'Sure, here you go:', appends 'Let me know if you need anything else!', and sprinkles in trailing commas, single quotes, or Python-style True/False/None. Calling JSON.parse on that raw text throws. An LLM JSON extractor scans the entire reply, isolates each balanced { … } or [ … ] block while respecting string boundaries, runs a repair pass on each one, and returns only the valid JSON — one block or many. It's the missing glue between a chat completion and the rest of your pipeline.

How to extract JSON from an LLM reply

  1. 1Copy the model's full response — you don't need to trim the surrounding text.
  2. 2Paste it into the input on the left.
  3. 3Each JSON block is extracted, repaired, and shown on the right; multiple blocks are combined into one array.
  4. 4Click Copy to grab the clean JSON for your code.

Use Cases

Post-process chat completions

When you can't use strict structured-output mode, extract the JSON from a free-form reply before feeding it to your app.

Debug flaky agents

Paste an agent's raw output to see exactly which JSON it produced and what needed repair, instead of guessing why your parser failed.

Key Concepts

JSON repair
Fixing near-JSON (trailing commas, single quotes, unquoted keys) into valid JSON.
Structured output
Provider modes that force the model to emit schema-conformant JSON. See the schema-to-tool generator.

Frequently Asked Questions

Why can't I just JSON.parse the model's reply?

Models rarely return clean JSON. They wrap it in ```json fences, add 'Here's your data:' before it, append 'Hope this helps!' after it, and slip in trailing commas or single quotes. This tool scans the whole reply, isolates each balanced { } or [ ] block, and repairs common issues before parsing.

Can it pull out multiple JSON blocks at once?

Yes. If the reply contains several JSON objects or arrays, each is extracted separately and combined into one array you can copy in a single click.

Is my data uploaded anywhere?

No. Extraction and repair run entirely in your browser with JavaScript. The pasted text never leaves your device.

Try Next

Schema → Tool Definition

Turn a sample JSON payload into function-calling / tool definitions for OpenAI, Anthropic, and Gemini — side by side. Strict-mode toggle adds required + additionalProperties: false. 100% local, paste straight into your tools array.

Related Tools

Reference & Guides