JSON Flattener
Flatten deeply nested JSON into a single-level object with dot-notation keys. Runs entirely in your browser.
Pure browser JavaScript — no external libraries.
How to use this tool
- Paste JSON or upload a .json file.
- Choose the key separator (default '.') and whether to index array items.
- Click Flatten, then Copy or Download the flat JSON.
Flatten deeply nested JSON into a single-level object with dot-notation keys. Runs entirely in your browser.
How it works
This tool converts a deeply nested JSON object into a single-level (flat) object where nested keys are concatenated with dot notation. For example, {"user": {"name": "Alice"}} becomes {"user.name": "Alice"}.
Paste your JSON and click Flatten. Arrays within the JSON can be flattened with index-based keys such as items.0.price and items.1.price. The result is a flat object that is easy to convert to CSV, insert into a database, or inspect without navigating nested structures.
Use this tool when dealing with API responses or config files that have complex nesting you need to tabularize, or when a downstream tool expects flat key-value pairs.
Everything runs in your browser with no upload needed.
Worked example
Flatten a nested API response to prepare it for CSV export
- Paste the nested JSON response into the tool.
- Click Flatten.
- Review the flat key-value pairs — nested paths are now dot-separated keys.
- Copy the flattened JSON.
- Paste it into the JSON to CSV tool to produce a one-row CSV.
{"order.id": 42, "order.customer.name": "Alice", "order.total": 99.50}
Common mistakes to avoid
- Flattening very large arrays, which produces an enormous number of keys and a hard-to-read output.
- Expecting the flattened output to be directly importable as CSV when array lengths differ across objects.
- Confusing dot-notation keys with actual nested structure — the output is a flat object, not a nested one.
Key terms
- Dot notation
- A naming convention where nested path segments are joined with periods, e.g. address.city for city inside address.
- Flat object
- A JSON object with only one level of depth — all keys are at the top level with no nested objects.
- Array indexing
- When arrays are flattened, each element is referenced by its zero-based position, e.g. tags.0 and tags.1.
Frequently asked questions
- How are arrays handled?
- With 'Index array items' on, each element gets a numeric segment (e.g. roles.0, roles.1). Turn it off to keep array values under the parent key.
- Is anything uploaded?
- No — flattening runs entirely in your browser.