Flatten nested JSON to dot notation

Convert nested JSON into a single-level object whose keys contain the original paths.

freeworks offlinenothing uploaded
ToolJSON Flatten
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

Nested objects and arrays are traversed depth-first and each leaf is emitted under a delimiter-joined path such as user.name or items.0.id. Empty containers can remain as leaf values so their presence is retained.

  • Dot notation is the familiar path default.
  • Empty containers remain distinguishable from absent paths.

Worked example

Nested Object
Flatten a nested object into dot-notation keys
Input
											{"user":{"name":"Alice","address":{"city":"Portland","zip":"97201"}},"active":true}
										
Output
												{
  "user.name": "Alice",
  "user.address.city": "Portland",
  "user.address.zip": "97201",
  "active": true
}
											

When to use this

Spreadsheet exports, search indexes, and flat logging fields use path flattening.

Edge cases

  • A key containing the delimiter becomes ambiguous without escaping.
  • An empty object remains when retention is enabled.
  • Array indexes become path segments, so reordering changes flattened keys.

References