JSON Flatten / Unflatten

Paste a nested JSON object to flatten all keys to a single level using dot, slash, or underscore separators. Arrays are indexed (e.g. list.0). Reverse the operation to unflatten a flat key-value map back into a nested structure. Runs entirely in your browser.

Browser-local No signup required JSON

Flatten a nested JSON object into path-like keys or rebuild a flat object into nested objects and arrays. Dot, slash, and underscore separators are available, and output can be pretty-printed or compact.

How to flatten or unflatten JSON

  1. Paste a valid JSON object into the input box.
  2. Choose dot, slash, or underscore as the key separator.
  3. Select Flatten to expand nested paths or Unflatten to rebuild them.
  4. Choose pretty output if you want indentation.
  5. Copy the resulting JSON.

How objects and arrays are handled

Flatten recursively expands plain objects. Arrays are expanded with numeric path segments such as items.0 or items/0, and object elements inside arrays are recursively expanded as well.

Unflatten splits keys using the selected separator. When the next path segment is all digits, it creates an array; otherwise it creates an object. Because separators are interpreted structurally, original keys that themselves contain the chosen separator can be ambiguous.

Privacy and limitations

Processing is performed locally in the browser and input JSON is not intentionally uploaded. The top-level input must be a non-null JSON object rather than an array or primitive. Unflattening is path-based and does not escape separator characters inside original key names, so choose a separator that does not conflict with your data.

Frequently asked questions

Are arrays flattened too?

Yes. Array indexes become numeric path segments.

Which separators are supported?

Dot, slash, and underscore are available.

Can the tool rebuild arrays?

Yes. During unflattening, numeric next segments cause arrays to be created.

Can I flatten a top-level JSON array?

No. The current implementation requires a top-level object.

What if a key already contains the separator?

That can make unflattening ambiguous because the separator is treated as a path boundary.