JSON extractor from LLM response
When a model returns JSON, it often buries it: a paragraph of explanation, a markdown code fence, the JSON, then more commentary — sometimes several blocks in one reply. This tool reads the whole response and pulls out every valid JSON object and array it can find, returning each one cleanly so you can copy exactly what you need.
How it works
The extractor scans the text for balanced spans that start with { or [.
It walks character by character, tracking whether it is inside a string literal
so that braces appearing inside string values never throw off the brace count.
When a span is balanced, it is run through JSON.parse; only spans that parse
successfully are kept. The result is a list of pretty-printed blocks, each
independently copyable, with prose and invalid fragments silently skipped.
Notes and tips
- Strictly valid only. Malformed blocks are skipped on purpose — run them through the LLM JSON Repair tool first if you need them.
- Multiple blocks are separated. One response with three objects gives you three copy buttons, not one tangled blob.
- Order is preserved. Blocks appear in the order they occur in the response, so the first match is the first object the model wrote.
- Everything stays local. The scan runs in your browser; paste freely.