JSON Flatten/Unflatten
Flatten nested JSON objects to dot-notation keys or unflatten flat objects back to nested structures.
Features
- ✓Flatten deeply nested JSON to dot-notation key-value pairs
- ✓Unflatten dot-notation objects back to nested JSON
- ✓Custom separator (default ".", also supports "/" or "__")
- ✓Handles arrays with numeric index keys
- ✓Preserves empty objects and arrays
- ✓Works entirely offline — your data never leaves your browser
How to Use
- 1Paste your JSON into the input field
- 2Choose "Flatten" or "Unflatten" mode
- 3Optionally change the separator character
- 4Click "Convert" to transform the JSON
- 5Copy the result from the output panel
Examples
Input
{
"user": {
"name": "John",
"address": {
"city": "Boston"
}
}
}Output
{
"user.name": "John",
"user.address.city": "Boston"
}Input
{
"user.name": "John",
"user.address.city": "Boston"
}Output
{
"user": {
"name": "John",
"address": {
"city": "Boston"
}
}
}What Is JSON Flattening?
JSON flattening converts a nested JSON object into a flat structure where each key is a dot-notation path representing the full location of the value. For example, {"user":{"name":"John"}} becomes {"user.name":"John"}. This transformation is useful when you need to work with flat data formats, analytics tools, or spreadsheets that do not support nested structures.
The reverse operation — unflattening — takes a flat object with dot-notation keys and reconstructs the original nested hierarchy. This is commonly needed when importing data from CSV files, flat databases, or key-value stores back into structured JSON for API consumption.
Arrays are handled by using numeric indices in the path. For example, {"users":[{"name":"John"},{"name":"Jane"}]} becomes {"users.0.name":"John","users.1.name":"Jane"}. When unflattening, numeric path segments are automatically converted back to array indices.
The separator is customizable. While the dot (.) is the most common convention, some systems use forward slash (/) for path-like notation or double underscore (__) for environments where dots have special meaning (like MongoDB field names or environment variables).
Common use cases include: exporting nested JSON to CSV/spreadsheet formats, building search indexes, creating flat configuration stores, transforming data for analytics pipelines, and debugging deeply nested API responses. The tool runs entirely in your browser — no data is sent to any server.