Extract JSON from Logs

Scan a wall of log lines or console output and recover every embedded JSON object or array. Each balanced {…}/[…] run is brace-matched (braces inside strings are ignored), validated with a strict JSON parser, and pretty-printed as its own block with the line it came from. Non-JSON braces and surrounding prose are skipped. Runs entirely in your browser — nothing is uploaded.

Try:
Extracted JSON

About this tool

Logs and console dumps are mostly unstructured text, but the useful part is often a bit of JSON hiding inside a line — a state={…} fragment, a serialized request/response, an array of ids. Copying those out by hand and reformatting them is tedious and error-prone. Paste the raw text here and this tool finds every embedded JSON object or array, validates each one, and pretty-prints them as separate blocks — right in your browser.

How it works:

Everything runs locally via WebAssembly — your logs never leave the page.

Worked example

Input (a few log lines with JSON embedded in two of them):

2026-07-24 10:12:01 INFO  starting worker
2026-07-24 10:12:02 DEBUG state={"user":"gizza","retries":0,"ok":true}
2026-07-24 10:12:03 INFO  batch ids [1, 2, 3] queued

Output (each block pretty-printed under a // block N (line L) header):

// block 1 (line 2)
{
  "user": "gizza",
  "retries": 0,
  "ok": true
}

// block 2 (line 3)
[
  1,
  2,
  3
]

The (line L) tag is the line the block started on, so you can jump back to the original log entry. Switch Output shape to array and the same input collapses into a single JSON array of all extracted values — handy for piping into another tool.

Options

Limits

FAQ

How does it tell real JSON from a stray brace in a log line?

Every {/[ starts a candidate. The tool brace-matches a balanced run and then parses it with a strict JSON validator. Only runs that parse successfully are kept, so a log line like shutting {down} or a smiley :-{ is matched, fails to parse, and is discarded — scanning simply resumes one character later. You never see false positives dressed up as JSON.

What about braces or brackets inside JSON string values?

They're handled. The matcher tracks whether it's inside a "…" string (respecting \" escapes), so a value like {"text":"a } b ] c"} matches as one complete object — the } and ] inside the quotes don't change the nesting depth. This is the main reason a naïve "count the braces" approach fails on real logs and this one doesn't.

Does it extract nested JSON as separate blocks?

No. Once a top-level object or array is matched, the tool skips past it, so a nested object like the inner {"b":1} in {"a":{"b":1}} stays inside its parent block rather than being reported again on its own. You get one block per top-level embedded value, which is almost always what log triage wants.

What's the difference between the "blocks" and "array" output shapes?

blocks (the default) is for reading: each extracted value is pretty-printed separately under a // block N (line L) header, blank-line separated, with the line number it came from — ideal for skimming a log dump. array is for reuse: every extracted value is wrapped into a single JSON array (e.g. [ {...}, {...} ]) that is itself valid JSON you can paste into another tool or save to a file.

Will it fix or repair malformed JSON?

No — validation is strict and deliberately so. Anything with a trailing comma, comment, single quotes, or unquoted keys is treated as "not JSON" and skipped, so you never get a plausible-but-wrong result. If your logs contain nearly-JSON that needs repairing first, run it through a dedicated JSON-repair step and then extract.

Is there a size limit, and is anything uploaded?

The input is capped at 2 MB — enough for large pasted console dumps — and oversized input is rejected with a clear message so you can split the log. Nothing is uploaded: the whole scan runs locally in your browser via WebAssembly, so even sensitive logs stay on your machine.

Developer & Automation Access

Run it from the terminal

Same engine as this page, headless — via the gizza CLI:

gizza tool json-from-logs '2026-07-24 10:12:01 INFO  starting worker
2026-07-24 10:12:02 DEBUG state={"user":"gizza","retries":0,"ok":true}
2026-07-24 10:12:03 INFO  batch ids [1, 2, 3] queued'

New to the CLI? Get gizza →

Open it by URL

Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:

https://gizza.ai/tools/json-from-logs/?text=2026-07-24%2010%3A12%3A01%20INFO%20%20starting%20worker%0A2026-07-24%2010%3A12%3A02%20DEBUG%20state%3D%7B%22user%22%3A%22gizza%22%2C%22retries%22%3A0%2C%22ok%22%3Atrue%7D%0A2026-07-24%2010%3A12%3A03%20INFO%20%20batch%20ids%20%5B1%2C%202%2C%203%5D%20queued&indent=2&output=blocks

Machine-readable descriptor: tool.json — title + parameters JSON Schema for agents.