TFT

JSON Unflatten Tool – Restore Nested Structure

Convert flattened dot-notation JSON back into a fully nested JSON structure. Our free JSON Unflatten Tool reverses flattening to restore your original data hierarchy.

About JSON Unflatten

Flattened JSON with dot-notation keys is common in form data and NoSQL databases, but sometimes you need the original nested structure back. This tool reverses the flattening process, restoring your JSON hierarchy automatically.

How it works

The tool parses each flattened key by splitting on your chosen separator character. It then rebuilds the nested structure by creating objects and arrays as needed based on the key path.

Numeric key segments are treated as array indices, allowing the tool to reconstruct arrays from flattened data. The default separator is a dot, but you can customize it to match your data format.

When you'd use this

You received form submission data where each field is a flattened key like user.address.city. Convert it back to nested JSON before processing or storing in your database.

This tool assumes well-formed flattened keys. If your data has inconsistent separators or mixed nesting patterns, you may need to preprocess it before unflattening.

Questions

What separator should I use?

The default dot separator works for most cases. Use a different character if your keys contain dots, like user.profile.name instead of user.name.

How are arrays reconstructed?

Numeric key segments become array indices. Keys like items.0 and items.1 will create an array with those values at positions 0 and 1.

What if I have conflicting paths?

If the same path appears with different types (object vs value), the last value wins. Ensure your flattened data doesn't have conflicting definitions.

Can this handle deeply nested data?

Yes, there's no practical limit to nesting depth. Very deep structures may take slightly longer to process but will unflatten correctly.

Can I download the result?

Yes. Use the Download button to save the unflattened JSON as a file, or Copy to paste it directly into your application code.