JSON extractor

Get the data out without hand-deleting the prose around it.

Models rarely return bare JSON. They add an apology, a summary, or a code fence — and any of those breaks a strict parser. This tool scans for the balanced first JSON value and hands it back.

  • Tolerates prose and fences
  • Bracket-balanced scan
  • Local parsing only
Try it now

Try it now

Paste the raw reply and press extract. If nothing valid is found, the tool says so plainly instead of returning something that merely looks like JSON.

JSON extractor

Pull the first valid JSON object out of a model reply, even when it is wrapped in prose or code fences.

Parsing happens entirely in your browser; the text never leaves this page.

Key Highlights

The naive approach — trimming whitespace and calling a parser — fails the moment a model prefixes its answer with "Sure, here is the JSON:". Wrapping the parse in a try/catch and progressively deleting characters mostly works until it silently returns a truncated-but-valid prefix.

This tool instead scans for the first position where a brace or bracket opens and counting begins, tracks nesting depth, and skips over string literals and escape sequences so that braces inside strings never confuse the depth counter. The first balanced span wins.

Specifications

Specifications
AcceptsObjects and arrays, in any surrounding prose or code fence
String-awareBraces and brackets inside string literals are ignored
Escape-awareEscaped quotes do not terminate a string early
Failure modeReports "no valid JSON found" rather than guessing
PrivacyParsing never leaves the browser

How to Use

  1. 1

    Paste the raw reply

    Exactly what the model returned, apology and all.

  2. 2

    Press extract

    The scanner locates the first balanced JSON value.

  3. 3

    Copy the result

    The extracted value is re-serialised so the whitespace is consistent.

Feature comparison
DimensionJSON extractorManual deletionStrict parser in code
Handles prose around the JSON✓✓✗
String-aware bracket matching✓✗✓
No setup required✓✓✗
Text stays local✓✓✓

Frequently Asked Questions

What if the reply contains several JSON values?

Only the first balanced value is returned. That is deliberate: when a model emits multiple values, the first is almost always the one you asked for.

Can it repair malformed JSON?

No. It extracts, it does not repair. A missing comma stays a missing comma, and the tool will report that no valid value was found.

Why not just strip the code fence?

Because fences are only one of many wrappers. Models also emit leading prose, trailing commentary or several values in sequence, so the extractor works on bracket structure instead of on formatting.

Try it on your messiest reply

Paste the worst one you have. Balanced brackets win, prose loses.

Open the JSON extractor