JSON Flattener

Flatten nested JSON into flat dot-notation key/value pairs โ€” or unflatten a flat object back into nested JSON.

Paste or type JSON above to flatten it into key/value pairs.

No uploads. Your files stay on your device.

Free forever, no sign-up, no cookies. Buy me a coffee

How it works

Flattening turns a deeply nested JSON document into a single level of key/value pairs, where each key is the full path to a leaf value โ€” user.address.city or user.tags[0]. That is exactly the shape you need for translation files, environment variables, spreadsheet columns, feature flags, log fields and diffing two API responses. Pick the separator (dot, underscore, slash or dash) and whether array items use bracket notation tags[0] or the separator tags.0, then export the result as a flat JSON object, plain key = value lines, or a two-column CSV you can open in Excel or Google Sheets.

Switch Direction to Unflatten to go the other way: paste a flat object and the original nested structure is rebuilt, with numeric segments turned back into arrays. Empty objects and arrays are preserved as and [] so a flatten/unflatten round trip gives you back what you started with โ€” untick the checkbox to drop them instead. Keys that already contain the separator character are ambiguous, so pick a separator your data does not use.

Everything runs in your browser with the native JSON.parse and JSON.stringify functions. Nothing is uploaded, so it is safe for API payloads, config files and anything else confidential.

Frequently asked questions

How do I flatten JSON to key/value pairs?

Paste your nested JSON into the box and it is flattened as you type: every leaf value gets a key that is its full path, like user.address.city or user.tags[0]. Choose the separator (dot, underscore, slash or dash) and whether array items use brackets or the separator, then copy the result or download it as JSON, key = value lines, or a two-column CSV.

Can I unflatten JSON back into a nested object?

Yes. Switch Direction to Unflatten, paste a flat object such as {"user.name": "Ada", "user.tags[0]": "dev"} and the original nested structure is rebuilt, with numeric or bracketed segments turned back into real arrays. Because empty objects and arrays are preserved as {} and [], a flatten then unflatten round trip returns exactly what you started with.

Is it safe to flatten confidential JSON online?

With this tool, yes: parsing, flattening and unflattening all run in your browser with the native JSON functions, so nothing is uploaded to a server. That makes it safe for API responses, access tokens and config files, unlike many online JSON utilities that send your payload to their backend.

Report a bug