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.