JSON Flatten / Unflatten
Flatten nested JSON to dot-notation key-value pairs and unflatten them back
About this tool
JSON objects often nest data several levels deep, like user.address.city or items[0].sku. Flattening turns those paths into flat keys such as user.address.city and items.0.sku, producing a single-level object that is much easier to import into a spreadsheet, query with jq, or store in a key-value database.
Flatten example:
Input: { "a": { "b": 1, "c": [10, 20] } }
Output: { "a.b": 1, "a.c.0": 10, "a.c.1": 20 }
Unflatten example:
Input: { "a.b": 1, "a.c.0": 10, "a.c.1": 20 }
Output: { "a": { "b": 1, "c": [10, 20] } }
Change the separator to match your data — some systems use underscores or double underscores instead of dots.
FAQ
When would I flatten JSON? ›
When you need to import nested API responses into a spreadsheet or CSV, store them in a flat key-value store like Redis or DynamoDB, or debug deeply nested config files by seeing every leaf at a glance.
When would I unflatten? ›
When a flat key-value source (like environment variables, query parameters, or a flat file) needs to be turned back into a structured object for your application code.
What happens to empty objects and arrays? ›
Empty objects and empty arrays are preserved as-is when flattening. When unflattening, numeric path segments like items.0 are detected and create arrays instead of objects.
Can I use a different separator? ›
Yes — select Dot, Underscore, Double underscore, Arrow, or Slash from the dropdown. Choose whichever matches the naming convention you already use.