JSON Flattener
Flatten nested JSON objects to dot-notation keys, or unflatten them back to nested structure. Fast, free, and works in your browser.
Input JSON
Output JSON
What Is a JSON Flattener?
A JSON flattener takes a deeply nested JSON object and squashes it into a single level using dot-notation keys. For example, { "user": { "name": "Alice" } } becomes { "user.name": "Alice" }. This is exactly what libraries like Lodash and flat do programmatically — this tool gives you a visual way to do the same thing. It's useful when you need to work with Elasticsearch flattened fields, dotenv-style config files, or any system that prefers a flat key-value structure. Arrays are handled too — scores[0] becomes scores.0. The unflatten mode is the reverse: give it dot-notation keys and get back the original nested object. Both conversions follow the JSON spec and are computed locally in the page, so your documents stay on your own machine.
How to Use
Paste or upload your JSON
Put the nested JSON you want to flatten in the left panel. Type it, paste it, or pull a file off disk with Upload.
Pick Flatten or Unflatten
Click Flatten to collapse nested keys to dot-notation. Click Unflatten to expand dot-notation keys back into a nested structure.
Copy or download the result
Copy places the flat (or rebuilt) object on your clipboard, while Download saves it as flattened.json for later.
Example
Here's a realistic before and after. Input is a nested user object with an address sub-object and a tags array.
Nested JSON → Flattened dot-notation
Input:
Output:
FAQ
What happens to arrays when I flatten?
Arrays are treated just like objects — each index becomes a numeric key. So ["a","b"] nested under tags becomes tags.0 and tags.1. This matches the behaviour of popular libraries like flat and is consistent with how Lodash _.get resolves paths.
Can I unflatten back to the original nested JSON?
Yes — switch to Unflatten mode and paste your dot-notation JSON. The tool reconstructs the nested structure. Note that if your original object had arrays, they'll come back as objects with numeric string keys unless the keys are sequential integers starting at 0. For round-trip fidelity this tool handles that case and rebuilds proper arrays.
What about null values?
Null values are kept as-is and the tool does not recurse into them. So { "user": null } stays as { "user": null } — it doesn't become {}. This matches the JSON spec (RFC 8259) where null is a valid leaf value.
Does this work with very deeply nested JSON?
Yes, the flatten function is recursive and handles arbitrary depth. For very large or deeply nested structures, the conversion runs in your browser using JavaScript so performance depends on your device. For most real-world API payloads it's instant.
What delimiter does the flattener use?
The delimiter is a dot (.), which is the most common convention and what tools like flat and Spring Boot application properties use. The delimiter is not configurable in this tool — if you need a custom delimiter, the flat npm package supports that via options.
Is my data safe?
Completely. Flattening and unflattening are done by script inside the page itself, so the JSON stays on your machine. Once the page has loaded you could even drop offline and keep working.