Developer Tools Runs in your browser Free · no account

JSON Flatten

The JSON flattener collapses a nested document into a single-level object whose keys are dot-separated paths, such as user.address.city. Array items become numeric segments. It is the shape you need for environment variables, spreadsheet columns and configuration systems that only accept flat keys.

Options
Nested JSON 0 characters
Flattened JSON

Your result will appear here.

Not sure where to start? Use Load example.

Results update automatically and are calculated on your device. Nothing you type is sent to a server.

Runs in your browser. Processing happens entirely in your browser. Nothing you enter is sent to Delimiter.live.

How to use the JSON Flatten

  1. Paste the nested JSON document.
  2. Choose the separator your target system expects — a dot is conventional, an underscore suits environment variable names.
  3. Read the flattened object: every leaf value now sits under its full path.
  4. Copy or download the result.

Example

Input
{"user": {"city": "London"}}
Output
{
  "user.city": "London"
}

Common use cases

  • Preparing nested configuration for a system that only accepts flat key-value pairs.
  • Turning a nested API response into spreadsheet columns.
  • Generating environment variable names from a config file.
  • Making two deeply nested documents easier to compare line by line.

Limitations and things to watch for

  • A key that already contains the separator character produces an ambiguous path, and unflattening it will not reproduce the original structure. Pick a separator your keys do not use.
  • Empty objects and empty arrays are preserved as empty values rather than disappearing, so the structure can be rebuilt.
  • Documents nested deeper than 100 levels are rejected, because that almost always indicates a cycle rather than real data.

Frequently asked questions

How are arrays flattened?
Array items become numeric path segments, so roles[0] appears as roles.0. That keeps the path unambiguous and lets the unflattener rebuild the array afterwards.
Can I get the original structure back?
Yes, with the JSON Unflatten tool, provided none of your original keys contained the separator character. Numeric segments are rebuilt as array indexes.
What if my keys contain dots already?
The resulting path becomes ambiguous and will not round-trip correctly. Choose a separator your keys do not use — the underscore and slash options exist for exactly this case.
Are empty objects preserved?
Yes. An empty object or array is kept as an empty value at its path rather than being dropped, so no information about the structure is lost.

Share this tool