Convert flat JSON with dot-notation keys into deeply nested objects and arrays instantly. Paste, click, and get results in milliseconds.
Three simple steps to convert any flat JSON into a clean, nested structure
Copy your flat JSON object with dot-separated or bracket-notation keys and paste it into the input editor on the left.
Select your delimiter (dot, slash, custom), indentation preference, and toggle safe mode if you want to skip malformed keys.
Click "Unflatten JSON" and instantly get the fully nested result. Copy or download it with a single click.
JSON unflatten is the reverse process of JSON flattening. When you flatten a JSON object, deeply nested keys are converted into a single-level object where each key represents the full path using a delimiter. For example, the nested object {"user": {"name": "John", "age": 30}} becomes {"user.name": "John", "user.age": 30} after flattening. Unflattening takes that flat representation and rebuilds the original nested hierarchy automatically.
This process is essential in many real-world scenarios. Data stored in databases like Redis or DynamoDB is often kept in a flat key-value format for performance reasons. When you retrieve this data, you need to reconstruct the nested structure for your application to use it properly. Similarly, URL query parameters, form submissions with bracket notation, and CSV imports with hierarchical column names all benefit from unflattening.
ToolGalaxy's JSON Unflatten tool is designed for developers, data engineers, and analysts who work with flat data structures daily. Here's why thousands of users trust it:
"items[0].name" and "items[1].price" are correctly converted into JavaScript arrays..), slashes (/), underscores (_), dashes (-), or any custom character, our tool handles them all.Our tool intelligently recognizes several key formats. Here's a practical example showing the input and output:
"Input (Flat):" { "user.name": "Alice", "user.email": "[email protected]", "user.address.city": "San Francisco", "user.address.state": "CA", "orders[0].id": 101, "orders[0].total": 59.99, "orders[1].id": 102, "orders[1].total": 129.50 } "Output (Nested):" { "user": { "name": "Alice", "email": "[email protected]", "address": { "city": "San Francisco", "state": "CA" } }, "orders": [ { "id": 101, "total": 59.99 }, { "id": 102, "total": 129.50 } ] }
APP_DB_HOST). Unflatten them into structured config objects.user[address][city] can be converted to nested JSON for API payloads.The unflatten algorithm works by splitting each flat key on the configured delimiter, then traversing or creating the nested object path for each segment. When a segment matches the pattern [number], it's treated as an array index rather than an object key. The algorithm handles sparse arrays, mixed object-array paths, and type conflicts gracefully. In safe mode, keys that would cause type conflicts (e.g., treating a string value as an object) are skipped with a warning in the status bar.
This tool is built with performance as a priority. The parsing uses a single-pass approach—each key is processed exactly once, and the result object is built incrementally without any intermediate copies or unnecessary allocations. This makes it suitable for processing large datasets directly in the browser without lag or memory issues.
Everything you need to know about the JSON Unflatten tool