JSON Flattener / Unflattener

Flatten deeply nested JSON to a flat object with dotted keys (user.address.city) — useful for tools that expect flat KV (analytics, logs, env vars). Or unflatten dotted-key data back into nested form.

How to use the JSON Flattener / Unflattener

Flatten: paste nested JSON, get back a flat object. Unflatten: paste a flat object with dotted keys, get the nested structure. Round-trip is exact for objects without numeric-string-only keys.

Flattening and unflattening JSON objects

Nested JSON is natural to read but awkward to feed into systems that expect flat key-value pairs — analytics events, log fields, environment variables, and many form encoders all want a single level of keys. Flattening turns a nested object into dotted paths like user.address.city, and the reverse rebuilds the hierarchy from those dotted keys.

This converts both ways with a configurable separator, and the round trip is lossless for ordinary objects. It flattens nested objects into dotted-key paths; if instead you have a nested array of arrays you want collapsed into one flat list of values, the JSON array flattener is the tool for that.

Common use cases

  • Analytics events — flatten nested payloads into the flat properties trackers expect.
  • Env vars — turn a config object into flat, dotted keys.
  • Diff-friendly form — flatten so two configs compare line by line.
  • Rebuild nesting — unflatten dotted keys back into a structured object.
  • Custom separator — use a different delimiter when keys already contain dots.

Frequently asked questions

Is the round trip lossless?

Yes for ordinary objects — flattening then unflattening with the same separator rebuilds the original structure.

Can I change the separator?

Yes — set any delimiter, which is useful when your keys already contain a dot.

Does it flatten nested arrays of values?

It flattens nested objects into dotted keys; to collapse a nested array into one flat list, use the JSON array flattener.

Where is flattened JSON useful?

Anywhere flat key-value pairs are expected — analytics events, log fields, environment variables, and similar.
Embed this tool on your site

Free to embed, no attribution required (but appreciated). Paste this where you want the tool to appear: