
Options
Paste nested JSON on the left and the flattened version appears on the right as you type, with every nested value turned into a single key like contact.address.city. Paste flat JSON with dotted keys and it's rebuilt into nested objects and arrays instead. Auto mode detects which one you need. You can pick the separator, write array positions as items.0.sku or items[0].sku, limit how deep it goes, and export the result as JSON or CSV. Large numbers like IDs are kept exactly as written, and everything runs in your browser.
How to flatten or unflatten JSON
- Paste your JSON into the left pane, or click Open file to load a .json file. You can also drag a file onto the pane.
- Leave the mode on Auto, or choose Flatten or Unflatten yourself.
- Choose a separator and an array style. Use the same settings to unflatten that were used to flatten.
- Switch the result to CSV if you want a spreadsheet. A top-level array of objects becomes one row per item and one column per key.
- Click Copy or Download.
Flattened vs. nested JSON
| Nested | Flattened (a.0.b) | Flattened (a[0].b) |
|---|---|---|
{"user": {"name": "Ada"}} | {"user.name": "Ada"} | {"user.name": "Ada"} |
{"tags": ["x", "y"]} | {"tags.0": "x", "tags.1": "y"} | {"tags[0]": "x", "tags[1]": "y"} |
{"items": [{"sku": "A-1"}]} | {"items.0.sku": "A-1"} | {"items[0].sku": "A-1"} |
{"meta": {}} | {"meta": {}} with Keep empty on, otherwise removed | Same |
{"file": {"v1.2": true}} | {"file.v1.2": true}, which can't be unflattened correctly | {"file[\"v1.2\"]": true}, which can |
When to use each option
Separator. A dot is the most common and matches tools like Lodash, MongoDB field paths, and Elasticsearch. Use an underscore or double underscore for environment variables (DATABASE__POOL__MAX is the .NET convention), a slash for JSON Pointer-style paths, and a colon for ASP.NET configuration keys. If your keys already contain the separator, pick a different one or use the a[0].b style, which quotes those keys. The tool warns you when two paths would collide.
Arrays. a.0.b treats array positions like any other key. a[0].b makes it obvious which parts are arrays and is what JavaScript and many form libraries use. Keep as arrays flattens objects but leaves arrays whole, which is handy when a list of tags should stay one value.
Depth. Limit flattening to one or two levels when you only want the top of the structure flat, for example to get one column per section in a spreadsheet while keeping each section's details together.
Flatten each item in a top-level array. When your JSON is a list of records, each record is flattened on its own instead of producing keys like 0.customer.name. That's the shape you want for CSV, Excel, and database imports.
How unflattening rebuilds arrays
When every key at one level is a whole number starting from 0, that level becomes an array. If some positions are missing, such as list.0 and list.2, the gap is filled with null and you'll see a warning. Keys written as [n] always become arrays. If one key holds a plain value and another key tries to nest inside it, as with "a": 1 and "a.b": 2, the nested value wins and the conflict is listed under the panes.
Frequently asked questions
What does it mean to flatten JSON?
Flattening turns nested objects and arrays into a single level of key and value pairs. Each key is the full path to the value, joined by a separator, so {"user": {"name": "Ada"}} becomes {"user.name": "Ada"}. Flat JSON is easier to put in spreadsheets, compare, search, and store in key-value databases.
Can I convert flattened JSON back to nested JSON?
Yes. Paste the flat JSON and choose Unflatten, or leave Auto on. Use the same separator and array style that were used to flatten it. With those settings, unflattening returns exactly the original structure.
How do I convert nested JSON to CSV?
Paste an array of objects, keep Flatten each item in a top-level array checked, and switch the result to CSV. Every flattened key becomes a column, so nested fields like customer.name get their own column. Items missing a key get an empty cell.
Will large numbers or IDs lose precision?
No. Most online tools use JSON.parse, which rounds integers above 9,007,199,254,740,991. This tool reads numbers as text and writes them back unchanged, so long IDs, trailing zeros like 1.50, and exponents stay exactly as they were.
What happens if a key already contains a dot?
With the a.0.b style, a key like "v1.2" can't be told apart from nesting, and two paths may produce the same flat key. The tool warns you when that happens. Switch the array style to a[0].b, which writes such keys as ["v1.2"], or choose a separator that doesn't appear in your keys.
Is my JSON uploaded?
No. The flattener runs entirely in your browser and your data is never sent to a server.
