How to Flatten JSON
Use this tool to turn nested JSON into path-keyed output. Choose dot notation, bracket notation, or a table, then adjust array, null, empty-container, and separator handling before you flatten the input. Default primitive values are preserved, but the selected options can omit or convert values, and branches deeper than 200 levels are truncated.
Choose the Output Format and Array Handling
Use Output notation to choose the result shape:
- Dot notation (a.b.0.c) joins path segments with the selected separator.
- Bracket notation (a.b[0]["c d"]) uses brackets for array indexes and keys that need them.
- Table (path / value / type rows) lists each result as Path, Value, and Type columns.
When using dot notation, set Separator (dot notation only). The field accepts up to three characters. Turn on Escape separator found inside keys (dot notation only) when literal separator characters occur in object keys.
For arrays, choose Expand into indexed keys to create paths such as items.0.name, or choose Keep arrays as values (no expansion) to store each array as a JSON-stringified value at its path.
Flatten JSON: Steps
- Paste JSON into the input area, or drop/upload a file.
- Set Output notation, the separator and escaping options if you use dot notation, and the array handling.
- Choose how Null values and Empty objects/arrays should be handled.
- Results update automatically as the input and settings change. Invalid JSON is reported in the settings area; correct the input or click Clear to start over.
- Review the output, stats, warnings, and any Key collisions.
- Click Copy or Export to use the result.
Review Output, Collisions, and Limits
Use the Null values and Empty objects/arrays controls to decide whether nulls and empty containers stay literal, become strings, or are omitted. These settings mean the output does not always contain every original value unchanged. Values below the depth limit keep their normal JSON types unless an option changes their representation.
A collision is reported when multiple writes produce the same generated flattened key. For example, a literal separator inside a key can produce the same path as a nested key when separator escaping is disabled. The report lists the contributing paths and the final value used; the last value written wins.
- The Table preview shows only the first 2,000 rows. Export includes all rows in the CSV.
- Dot and bracket output downloads as
flattened.json. Table output downloads asflattened.csv. - For table output, Copy copies the Path and Value columns, not the Type column.
- Branches deeper than 200 levels are replaced with a truncation placeholder and listed in warnings.
- For an uploaded file over 300,000 characters, only the textarea preview is truncated; the full file content is processed.
Input Processing and Privacy Scope
The flattening workflow parses pasted and uploaded JSON locally in the browser. The JSON content is not sent to a server. Analytics and the subscription form are separate page features.
Frequently Asked Questions
How is this different from the CSV/JSON Converter?
The CSV/JSON Converter changes the interchange format - JSON to CSV or back - reshaping rows and columns. This tool stays within JSON's own value model: it removes nesting by turning every leaf value into a single path-keyed entry, without converting to a different format.
What happens to arrays?
By default, arrays expand into indexed keys, so items.0.name and items.1.name become separate flattened entries. Switch to Keep arrays as values (no expansion) to leave each array intact as a single JSON-stringified value at its path.
What is a key collision?
A collision happens when multiple writes produce the exact same generated flattened key. A key that literally contains your separator character can collide with a nested path when escaping is disabled. The tool lists the contributing original paths and the final value used; the last value written wins.
How are null values and empty objects/arrays handled?
You choose. Null values can be kept as null, converted to an empty string, or omitted entirely. Empty objects ({}) and empty arrays ([]) can be kept as their empty literal value, kept as the marker strings "{}" or "[]", or omitted from the output, since they have no leaf value to flatten.
What counts as an unsupported structure?
Since the input must be valid JSON, most invalid constructs are rejected at parse time. The tool separately flags branches that exceed a safe nesting depth (200 levels) as truncated, since flattening them further risks a runaway key count rather than a useful result.