JSON Flattener
Convert nested JSON to flat structure and back
Instant Transform
Real-time flattening and unflattening
100% Private
All processing happens in your browser
No Signup
Free tool, no registration required
JSON Flattening: Turning Nested Structures Into Flat Key-Value Pairs
JSON flattening converts a deeply nested JSON object into a single-level object where each key represents the full path to a value using dot notation or a custom delimiter. A nested structure like {"user": {"address": {"city": "London"}}} becomes {"user.address.city": "London"}. The reverse operation, unflattening, reconstructs the nested structure from the flat representation.
Why Flatten JSON?
Analytics and reporting: Many analytics tools, spreadsheets, and databases expect flat, tabular data. Flattening makes nested JSON compatible with CSV exports, SQL INSERT statements, and pivot tables. Search indexing: Full-text search engines like Elasticsearch often work better with flat documents — nested objects can cause mapping issues. Form libraries: Some form state management libraries (like react-hook-form) use dot-notation paths for nested field names, which are essentially flattened key names. Debugging: A flat view of a deeply nested API response is often easier to scan than collapsing and expanding tree nodes.
Delimiter Choice
The default delimiter for flattened keys is a dot (.), producing paths like address.city. Use an underscore (_) when the target system doesn't support dots in key names — some databases and analytics platforms prohibit dots. Array elements are typically represented as items.0, items.1, etc.
How to Use This Tool
Paste your nested JSON, choose a delimiter, and click Flatten. The flat key-value output appears immediately. To reverse the process, paste the flat JSON and click Unflatten to reconstruct the original nested structure.