JSON Flatten & Unflatten

Flatten nested JSON into single-level dot-notation keys — or rebuild nested JSON from flat keys.

Tool input is processed locally in your browser and is not submitted to CodeNimbleTools. Avoid pasting production secrets into any device or website you do not fully trust.

Result

  

About this tool

Nested JSON is great for structure but painful for spreadsheets, form data, environment configs and diffing. This tool flattens any JSON document into a single-level object with dot-notation keys — and reverses the process just as easily.

Choose your own delimiter and switch to [0]-style array indexes when you need round-trip safety with keys that contain dots.

How to use it

  1. Pick a mode: Flatten or Unflatten.
  2. Paste your JSON (nested for flatten, flat key/value pairs for unflatten).
  3. Adjust the delimiter if your keys contain dots.
  4. Copy or download the result as JSON.

Useful ways to apply it

  • Preparing nested API data for CSV export or spreadsheets.
  • Converting config files between nested and flat (.env-style) shapes.
  • Diffing two JSON documents line-by-line after flattening.
  • Building form field names like address.city from an object.

Worked example

Example input

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

Expected output

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

Edge cases to check

  • Keys containing the selected delimiter can be ambiguous.
  • Sparse arrays and numeric object keys can be difficult to distinguish during unflattening.
  • Very deep objects can hit browser recursion or memory limits.

Known limitations

Flattening is a path-encoding convention, not a JSON standard. Test round trips with keys that contain dots, brackets or numeric-looking names.

How this tool was reviewed

Reviewed with nested objects, arrays, nulls, booleans, empty containers and delimiter collisions.

Last reviewed: September 3, 2026 · Maintainer: William

Standards and technical references

Frequently asked questions

How are arrays handled?
Array elements become numeric segments: {"tags":["a"]} flattens to "tags.0": "a" (or tags[0] with the bracket option). Unflatten detects numeric segments and rebuilds real arrays.
What if my keys contain dots?
Switch the delimiter to something not used in your keys (like | or /), or enable bracket-style array indexes to reduce ambiguity.
Is there a depth limit?
There is no site-defined nesting limit, but very deep documents can hit browser recursion or memory limits. Test representative data and watch for delimiter collisions when round-tripping.

Privacy

Tool input is processed locally in your browser and is not submitted to CodeNimbleTools. Avoid pasting production secrets into any device or website you do not fully trust.