JSON Flatten

Turn nested JSON into a single level of key paths: {"order": {"customer": {"name": "Ravi"}}} becomes {"order.customer.name": "Ravi"}. Array items get their index in the path. Flat JSON maps straight onto spreadsheet columns, environment variables, search indexes and translation files, and you can turn it back with one click.

Action
JSON
Result

7 paths.

Processing runs in your browser. What you type never leaves this device.

Features

  • Dot, underscore, slash or double-underscore separators

  • Array indexes as items.0.sku or items[0].sku

  • Empty objects and arrays are kept, so nothing is lost

  • Count of paths produced

  • Reverse button to unflatten

  • Runs in your browser

Where flat JSON helps

Spreadsheets and CSV

Each path becomes a column header. For many records at once, the [JSON to CSV converter](/tools/json-csv-converter) does this for a whole array.

Environment variables

Use the double-underscore separator to get keys like DATABASE__HOST, the format .NET and many config libraries read.

Translation files

Flat keys such as checkout.button.pay are easier to hand to translators and compare across languages.

How paths are built

The rules

  • Each nested key is joined to its parent with the separator.
  • Array items use their position: items.0, items.1 (or items[0] with bracket style).
  • Empty objects {} and arrays [] stay as values so unflattening restores them.

Going back

Press Reverse, or use JSON unflatten. Use the same separator in both directions.

JSON Flatten - FAQ