About this JSON flatten tool
Paste JSON on the left and click Flatten or Unflatten. The separator lives in the output column header (dot by default). Nothing runs until you press a button; changing the separator alone re-runs only after you already have a result.
Flatten turns nested objects into one layer of keys joined by the separator—often called dot notation when the separator is a dot. Arrays stay indexed with brackets, for example tags[0] and items[0].id. Unflatten rebuilds nesting with the same separator. Processing stays in your browser.
JSON flattening — background
Dot notation and path strings
Many log pipelines, CSV exporters, and config systems represent nested JSON as flat keys: user.profile.name instead of a nested object. The separator is a convention, not part of JSON syntax—this tool only changes how keys are written in a single JSON object.
Brackets for arrays, separator for objects
Array indexes always use [0], [1], … between object segments. The chosen separator is not inserted inside brackets. Nested arrays become paths like matrix[0][1]. Empty {} and [] are kept so Unflatten can restore structure.
Escapes, conflicts, and round trip
- If a real key name contains the separator or brackets, it is escaped in the flat key and restored on Unflatten.
- Unflatten rejects ambiguous paths (for example tags[0] and tags[2] without tags[1]) instead of inventing null placeholders.
- Unflatten expects a flat object at the root; paste a flattened array document only after flattening an array root first.
What flattening does not do
Values are not coerced: numbers, strings, booleans, and null stay as JSON types. Key order in the output follows the walk order of the nested input. Pretty spacing is applied for readability; use the JSON formatter if you need minify or tree view.
Typical workflows
Spreadsheet or ETL column mapping
Flatten an API payload when each leaf value should become one column header such as order.customer.email.
Round trip before sending JSON again
Flatten for inspection, edit flat keys if needed, then Unflatten with the same separator before posting back to an API that expects nested objects.