Logo JSON Parser Online

Flatten Nested JSON to Dot Notation

Paste a nested JSON object and click Flatten. Each nested key path is collapsed into a single dot-separated key — for example, {"address": {"city": "London"}} becomes {"address.city": "London"}. Useful for converting nested configs to flat key-value stores, preparing data for CSV export, or querying deeply nested paths.

All JSON Tools

28 tools

Free, fast, runs in your browser. No login needed.

Made with ❤️ in India · © 2025 parsejsononline.com
INPUT
1
OUTPUT
1
✅ Ready
Characters: 0
Ctrl+Enter to run
What is this tool?

How to use

  1. Paste your nested JSON object into the INPUT pane.
  2. Optionally change the separator character (default is .).
  3. Click Flatten.
  4. The output is a flat object where every key is the full path to a leaf value.

How it works

The flattener walks your JSON object recursively. When it encounters a nested object, it joins the parent key and child key with the separator character to form a compound key. It continues until it reaches a leaf value — a primitive (string, number, boolean, null) or an array.

Arrays are preserved as-is. An array-valued field is treated as a leaf — it is not expanded into indexed keys like items.0, items.1, etc. The full array value remains assigned to the compound key. If you need indexed flattening of arrays, flatten the array elements individually before passing to this tool.

Custom separator. The default separator is a dot (.), producing keys like user.address.city. You can change it to any character — for example, __ or / — using the input field next to the Flatten button. This is useful when your key names already contain dots.

Reversing the operation. Use the Unflatten JSON tool to reconstruct the nested structure from a flattened object. Set the same separator in both directions.

Common use cases: preparing nested JSON for CSV export (the CSV converter also does this automatically); storing config values in a flat key-value store like Redis or environment variables; comparing deeply nested paths after a data migration.

FAQ

What happens to arrays inside the JSON?

Arrays are preserved as leaf values and not expanded. For example, {"tags": ["a", "b"]} becomes {"tags": ["a", "b"]} — unchanged. The flattener only descends into objects, not arrays.

Can I change the separator from a dot to something else?

Yes. Enter any character or string in the separator field before clicking Flatten. Use a separator that does not appear in your key names to avoid ambiguity when unflattening.

How do I reverse flattening?

Use the Unflatten JSON tool. Paste the flattened output, set the same separator, and click Unflatten to restore the nested structure.

What if my keys already contain dots?

Flattening with the default dot separator will produce ambiguous output if any original keys contain dots. Switch to a separator that does not appear in your key names.

Is there a depth limit?

No depth limit is enforced. Arbitrarily deep nesting is supported up to the browser's JavaScript call stack limit.

Is my data sent anywhere?

No. Flattening runs entirely in your browser.

Related tools

Unflatten JSONReverse dot-notation keys back to nested JSON. JSON to CSVFlattens nested objects automatically during CSV conversion. JSONPath TesterQuery specific paths in nested JSON without flattening.