JSON Flattener

Flattens nested JSON objects and arrays into a single-level object with dot/bracket-notation keys, or reconstructs nested JSON from flat keys in reverse. Nothing leaves your browser.

Private by architecture: All processing is 100% client-side memory. Your data never leaves this browser tab.
JSON input
0 lines · 0 charsJSON
Flattened output
Ctrl/Cmd+Shift+C
0 charsJSON

About This Tool

Deeply nested JSON (API responses, config trees, event payloads) is awkward to search, diff, or load into flat systems like spreadsheets or key-value stores. Flattening collapses every leaf value into a single-level object whose key spells out the original path, such as a.b[0]. Unflatten runs the same logic in reverse, rebuilding the nested structure from flat keys.

Both directions round-trip exactly: flattening a value and then unflattening the result reproduces the original structure, including empty objects and arrays.

Key Features

  • Bidirectional: One Direction dropdown (or the swap button) switches between Flatten and Unflatten.
  • Configurable delimiter: Dot (.) or slash (/) between object key segments.
  • Two array notations: Bracket style (a[0]) or dot style (a.0).
  • Exact round-trips: Flatten then unflatten reproduces the original value, including empty {} and [] leaves.
  • File upload & drag-and-drop: Load a .json or .txt file directly.
  • Keyboard-driven: Cmd/Ctrl+Enter to convert, Cmd/Ctrl+Shift+C to copy output.

Frequently Asked Questions

Can I reverse a flattened result back to nested JSON?
Yes. Switch the Direction dropdown to "Unflatten" (or click the swap button) using the same delimiter and array notation it was flattened with.
What is the difference between bracket and dot array notation?
Bracket style writes array indices as a[0], attached directly to the parent key. Dot style writes them as a.0, using the same delimiter as object keys: simpler to read, but ambiguous if an object itself has purely numeric keys.
Does unflattening always reproduce the exact original structure?
Yes, for any value this tool flattened, including empty objects and arrays: those are kept as leaf values rather than dropped, specifically so the reverse direction can restore them.
What happens to object keys that already contain the delimiter character?
They are indistinguishable from a path separator once flattened, so unflattening a hand-edited key containing the delimiter may split where you didn't intend. Use a delimiter your keys do not contain, or the slash option if your keys contain dots.