JSON Unflatten

If you've ever pulled data out of a spreadsheet, a database export, or an analytics tool, there's a good chance you've run into "flat" JSON the kind where nested fields get squashed into single keys using dots, like "user.address.city" instead of a proper nested address object. It's a common format for storage and tabular tools, but it's a pain to work with once you actually need to use that data in an application, API, or config file.

That's what this JSON Unflatten Tool is for. It takes flat, dot-notation JSON and rebuilds it into the properly nested structure it was probably meant to have in the first place so "user.address.city": "Delhi" becomes a real nested object: { "user": { "address": { "city": "Delhi" } } }.

It's built for developers, backend engineers, and anyone who's had to deal with flattened exports from BigQuery, Elasticsearch, spreadsheets, or logging systems and needed the data back in a usable, hierarchical shape.

What Does This Tool Actually Do?

In simple terms: it reverses flattening.

When JSON gets "flattened," every nested key path gets collapsed into a single top-level key, usually joined by dots (sometimes underscores or other separators, depending on the source). This is common because flat structures are easier to store in spreadsheets, CSVs, or single-column database fields.

The problem is, flat JSON isn't how most applications expect to receive or work with data. APIs, frontend frameworks, and config systems generally expect proper nested objects not keys like settings.theme.color.

This tool parses those dotted keys and rebuilds the full object hierarchy automatically.

Example Before (Flat JSON):

{ "name": "Rohan Sharma", "address.city": "Pune", "address.pincode": "411001", "contact.email": "[email protected]", "contact.phone.mobile": "9876543210" }

Example After (Unflattened / Nested JSON):

{ "name": "Rohan Sharma", "address": { "city": "Pune", "pincode": "411001" }, "contact": { "email": "[email protected]", "phone": { "mobile": "9876543210" } } }

Notice how every dotted key path gets rebuilt into its own nested level, no matter how deep it goes. The tool also correctly handles arrays when index-style keys are present (e.g., items.0.name, items.1.name), reconstructing them as actual array elements rather than leaving them as object keys.

Why Would You Need to Unflatten JSON?

Flattened JSON shows up in more places than people expect, and once you have it, you usually need to convert it back for one of these reasons:

1. Re-integrating exported data

Data exported from spreadsheets, CSVs, or BI tools often flattens nested structures automatically. If you're feeding that data back into an app or API, you need the original hierarchy restored.

2. Working with analytics or logging platforms

Tools like Elasticsearch, Google Analytics exports, and event-tracking systems often store data in flat key-value form for indexing efficiency. When you pull that data out for reporting or app use, you often need it nested again.

3. Config file management

Some systems store configuration as flat key paths (database.host, database.port) for simplicity in .env-style files, but your application code expects a nested config object.

4. API compatibility

Some APIs expect deeply nested payloads. If your data pipeline only has flat records, you'll need to unflatten before sending the request.

5. Debugging and readability

Flat JSON with dozens of dotted keys is genuinely hard to read. Unflattening it makes the structure visually clear and much easier to reason about, especially for deeply nested data.

Flat JSON vs Nested JSON Quick Comparison

AspectFlat JSONNested JSON
Key format"a.b.c": "value"{ "a": { "b": { "c": "value" } } }
ReadabilityHarder for deep structuresEasier to follow hierarchy
StorageWorks well in tables/CSVNeeds structured storage (documents, objects)
API usageRarely expected as-isStandard format for most REST/JSON APIs
Common sourceSpreadsheets, Elasticsearch, analytics exportsApplication code, config files, JSON APIs

Both formats represent the same data; the difference is purely structural. Unflattening doesn't add or remove any information; it just reorganizes existing key-value pairs into their natural hierarchy.

Key Features

  • Instant unflattening dotted keys are converted to nested objects in real time
  • Array reconstruction numeric index keys (like tags.0, tags.1) are rebuilt as actual arrays, not object properties
  • Deep nesting support handles multiple levels of nesting without breaking structure
  • Paste or upload input bring in JSON directly or upload a .json file
  • Copy or download output no server-side data retention
  • Runs in your browser no server-side data retention
  • Handles large payloads built to process sizeable JSON files without lag
  • Mobile-friendly interface works the same on phone, tablet, or desktop

How to Use the Tool

Step 1: Paste or Upload Flat JSON

Drop your flat JSON with dot-notation keys into the input box, or upload a .json file directly.

Step 2: Click "Unflatten"

The tool parses every key path and rebuilds the nested object structure automatically.

Step 3: Copy or Download the Result

Copy the nested JSON to your clipboard or download it as a ready-to-use .json file.

That's it no configuration, no separator settings to fuss over for standard dot-notation input.

Common Use Cases

  • Developers restoring nested structures after pulling data from flat storage formats
  • Backend Engineers preparing API request bodies that require nested payloads
  • Data Engineers converting flattened exports from data warehouses back into usable JSON
  • QA/API Testers reconstructing realistic nested test payloads from flat test data sheets
  • DevOps converting flat .env-style config keys into nested configuration objects
  • Analysts making flat analytics export data more readable before sharing or reporting

Benefits of Using This Tool

  • Saves the time of writing a custom unflatten script for a one-off task
  • No installation or setup works directly in the browser
  • Correctly distinguishes between object keys and array indexes during reconstruction
  • Free to use, with no login or signup required
  • Clean, properly indented output ready to paste into your codebase

Privacy & Security

Flattened data often comes from real production exports user records, configuration values, or business data so handling it responsibly matters

  • Your JSON is processed only to perform the conversion you request
  • Data pasted or uploaded is not permanently stored on our servers
  • No account creation is required, which keeps your data footprint minimal

If you're working with regulated or highly sensitive data, we'd still recommend checking your organization's data-handling policy before pasting it into any third-party web tool that's just good practice regardless of which tool you use.

Frequently Asked Questions (FAQs)

It means converting flat JSON where nested fields are represented as single dot-separated keys like "user.name" back into a properly nested object structure like { "user": { "name": "..." } }.

Flattening usually happens when data needs to be stored in a table, spreadsheet, or single-column database field, where nested objects aren't naturally supported. Tools like Elasticsearch, CSV exporters, and some analytics platforms flatten JSON for this reason.

Yes. If your flat keys follow an index pattern like items.0.name and items.1.name, the tool detects the numeric indexes and rebuilds them as an actual array instead of leaving them as object properties.

By default, it works with the standard dot (.) separator, which is the most common convention for flattened JSON.

Yes, there's no practical depth limit for typical use cases the tool will reconstruct however many levels your dotted keys represent.

No. Unflattening only reorganizes the structure of your keys; it doesn't modify, delete, or alter any of the actual values.

No. Your data is used only to perform the requested conversion and isn't retained after processing.

The tool comfortably handles typical file sizes used in day-to-day development work. For extremely large datasets (multi-gigabyte files), a script-based backend approach is usually more practical.

Yes, completely free with no usage restrictions for standard file sizes.

The tool will flag the syntax issue before attempting conversion, since valid JSON input is required to produce a valid nested output.

Yes, the interface is fully responsive and works the same across desktop, tablet, and mobile browsers.

Yes, if you need to go the other direction, our JSON Flatten Tool converts nested JSON into flat, dot-notation key-value pairs.

From Our Blog

View all blogs
Online JSON Formatter