Extract JSON from text
ClientPaste logs, API transcripts, or messy notes—this page finds the first {...} or [...] span that is valid strict JSON and shows it formatted for copying into other JSON tools.
Learn more: extract from mixed text
Scan left-to-right for the first `{` or `[`, walk with string-awareness until brackets balance, then `JSON.parse` the span—so braces inside quoted strings do not confuse the scan.
Strict JSON
Only spans that satisfy `JSON.parse` are returned. Loosen comments or trailing commas on the JSON formatter or JSON5 page after you copy the extracted fragment.
Why not the first primitive?
Root numbers, booleans, or quoted strings appear often inside prose; matching only objects and arrays reduces accidental captures. If you truly have a scalar literal, paste a short wrapper or trim surrounding words first.
Extract JSON
?
Scans for the first { or [ that closes as a valid JSON object or array (strings can contain braces). Root scalars such as bare true are skipped—wrap them in an array in the source if needed.
Matched characters 44–100 in the paste.
Common use cases
- Grab the JSON body from a log line that also prints timestamps, levels, and HTTP metadata.
- Recover an object from chat or email where prose wraps the payload—without hand-selecting braces.
- Sanity-check what the parser will accept before moving the snippet to the formatter or compare tools.
Common mistakes to avoid
Expecting bare numbers, booleans, or quoted strings at the root
This tool matches only object and array containers. If the payload is the word true or a numeric literal, wrap it in JSON first or paste a larger fragment that includes braces.
Assuming JSON5 or trailing commas will parse
Extraction uses JSON.parse semantics. Comments, single quotes, or trailing commas must be fixed on the JSON formatter or JSON5 page after you isolate the span.
FAQ
Why did it pick the wrong block?
The scanner takes the first object or array from left to right that both balances brackets and parses. If an earlier brace belongs to non-JSON text, remove or trim that prefix first.
Is my paste uploaded?
No. Matching and parsing run in your browser tab; clear the field when you are done if the text is sensitive.
Common search terms
Phrases people search for that match this tool. See the full long-tail keyword index.
- extract json from log text
- parse json from mixed text online
More tools
Related utilities you can open in another tab—mostly client-side.
JSON formatter
ClientJSON format online: pretty-print, minify, validate, escape, download .json.
JSON5 / JSONC → JSON
ClientParse JSON5 and JSON with comments—output strict JSON, pretty or minify in browser.
JSON syntax rules
ClientRFC 8259 rules with a browser JSON.parse checker, hints for common syntax mistakes.
NDJSON / JSON Lines
ClientNewline-delimited JSON: lines to array, array to lines, validate, minify—client-side.