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:
CommentsPaste 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.
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
- 1Copy the model's full response — you don't need to trim the surrounding text.
- 2Paste it into the input on the left.
- 3Each JSON block is extracted, repaired, and shown on the right; multiple blocks are combined into one array.
- 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
Text Chunker
Split long text into overlapping chunks for embedding and RAG pipelines. Preview recursive, paragraph, sentence, or fixed strategies with live token counts. Runs 100% in your browser.
Cosine Similarity
Compute cosine similarity, dot product, and Euclidean distance between two vectors online. Perfect for debugging LLM embeddings, semantic search, and RAG pipelines. 100% local — vectors never leave your browser.
AI Cost Calculator
Estimate monthly LLM API cost across GPT-4o, Claude 3.5, Gemini, DeepSeek and 100+ models. Compare providers side-by-side with prompt-caching and batch discounts. Free, no signup — prices refreshed daily from the public LiteLLM catalog.
Token Counter
Count tokens in your prompt for GPT-4, GPT-3.5, Claude, and Gemini and predict API cost before you spend. Free, no signup — all counting runs locally, your prompt stays in your browser.
Context Window Checker
Check whether your prompt fits a model's context window before you send it. Estimates prompt tokens, reserves room for the response, and shows remaining headroom across GPT-4o, o1, Claude, Gemini, DeepSeek and more. 100% local.
Prompt Token Breakdown
Break a prompt into segments and see how many tokens — and how much cost — each part uses. Find the heaviest section (system, few-shot examples, or user input) so you know exactly what to trim. 100% local.