JSON Flatten & Unflatten
Flatten nested JSON into single-level dot-notation keys — or rebuild nested JSON from flat keys.
Tool input is processed locally in your browser and is not submitted to CodeNimbleTools. Avoid pasting production secrets into any device or website you do not fully trust.
About this tool
Nested JSON is great for structure but painful for spreadsheets, form data, environment configs and diffing. This tool flattens any JSON document into a single-level object with dot-notation keys — and reverses the process just as easily.
Choose your own delimiter and switch to [0]-style array indexes when you need round-trip safety with keys that contain dots.
How to use it
- Pick a mode: Flatten or Unflatten.
- Paste your JSON (nested for flatten, flat key/value pairs for unflatten).
- Adjust the delimiter if your keys contain dots.
- Copy or download the result as JSON.
Useful ways to apply it
- Preparing nested API data for CSV export or spreadsheets.
- Converting config files between nested and flat (.env-style) shapes.
- Diffing two JSON documents line-by-line after flattening.
- Building form field names like
address.cityfrom an object.
Worked example
Example input
{"user":{"name":"Ada","roles":["admin","editor"]}}
Expected output
{"user.name":"Ada","user.roles.0":"admin","user.roles.1":"editor"}
Edge cases to check
- Keys containing the selected delimiter can be ambiguous.
- Sparse arrays and numeric object keys can be difficult to distinguish during unflattening.
- Very deep objects can hit browser recursion or memory limits.
Known limitations
Flattening is a path-encoding convention, not a JSON standard. Test round trips with keys that contain dots, brackets or numeric-looking names.
How this tool was reviewed
Reviewed with nested objects, arrays, nulls, booleans, empty containers and delimiter collisions.
Standards and technical references
See the site-wide testing methodology for fixture categories, privacy checks and correction policy.
Frequently asked questions
How are arrays handled?
What if my keys contain dots?
Is there a depth limit?
Privacy
Tool input is processed locally in your browser and is not submitted to CodeNimbleTools. Avoid pasting production secrets into any device or website you do not fully trust.