Nested JSON Flattener

Flatten deeply nested LLM JSON output into a dot-notation key-value map.

Ad placeholder (leaderboard)

Flatten nested LLM JSON into flat keys

Structured LLM outputs and tool-call payloads nest objects inside arrays inside objects. That’s painful to map into a spreadsheet, a form, or a flat config. This tool turns any nested JSON into a single-level key-value map where each key is the full path to a leaf value — in either dot notation (a.b.0.name) or bracket notation (a.b[0].name) — with an optional depth limit.

How flattening works

The flattener walks the JSON recursively. Whenever it hits a leaf — a string, number, boolean, null, an empty object, or an empty array — it records the accumulated path as a key and the leaf as the value. Non-empty objects and arrays are expanded: object keys are appended as path segments and array elements are appended as numeric indices. If you set a maximum depth, descent stops at that level and the remaining structure is kept intact as a JSON value, so nothing is lost. The result is one flat object you can read top to bottom.

Tips and examples

  • Use dot notation when you’ll feed the keys into tools that expect a.b.0 paths; use bracket notation when you want valid JavaScript-style accessors.
  • Flatten a tool-call arguments object to quickly diff two responses field by field.
  • Set a shallow depth (1 or 2) to get a high-level overview of a huge payload before drilling in with the JSON Pointer Extractor.
  • Empty containers are preserved as {} / [] so the flattened map round-trips the original structure faithfully.
Ad placeholder (rectangle)