JSON Flattener

Flatten nested JSON into single-level dot-path keys — in your browser.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

JSON flattener

Deeply nested JSON is awkward to diff, map onto environment variables or store in a flat key/value system. This tool collapses a nested JSON object or array into a single-level object where every leaf value is keyed by its full path, so the whole structure becomes a tidy list of path/value pairs.

How it works

The flattener walks the JSON recursively, building up a path as it descends:

  • Object keys are appended using your chosen delimiter (a dot by default), so a then b becomes a.b.
  • Array items append their index — roles.0 in dot mode, or roles[0] if you enable bracket notation.
  • Empty objects and arrays are kept as leaf values ({} / []) at their path so nothing is lost and the structure can be rebuilt exactly.

Each leaf value (string, number, boolean or null) is copied unchanged.

Example

This nested input:

{ "user": { "name": "Sam" }, "roles": ["admin", "editor"] }

flattens (with dot indices) to:

{
  "user.name": "Sam",
  "roles.0": "admin",
  "roles.1": "editor"
}

Switch on bracket notation and the array keys become roles[0] and roles[1], which round-trips cleanly through the unflatten tool. Everything runs in your browser — your JSON never leaves your device.

Ad placeholder (rectangle)