{ JSON Unflattener }

// restore dot-notation JSON back into nested objects

Restore dot-notation flattened JSON back into deeply nested objects and arrays instantly. Free, browser-based, no sign-up required.

Paste a flat JSON object with dot-notation keys (e.g. "user.name": "Alice")
{ }

Nested JSON will appear here

Paste flattened JSON and click Unflatten

HOW TO USE

  1. 01
    Paste flattened JSON

    Paste your flat JSON object with dot-notation keys like "a.b.c": "value" into the input area.

  2. 02
    Choose options

    Select the delimiter used in your keys (default is dot) and your preferred output indentation.

  3. 03
    Click Unflatten

    The nested JSON is restored instantly. Numeric indexes are auto-converted back to arrays.

FEATURES

Dot Notation Array Detection Custom Delimiters Pretty Print Depth Stats Browser-side

USE CASES

  • 🔧 Restore config files flattened for env vars
  • 🔧 Convert Redux state snapshots back to nested form
  • 🔧 Reconstruct API payloads from flat form data
  • 🔧 Debug flat DB columns into original JSON structure

WHAT IS THIS?

JSON Unflattener is the reverse of JSON flattening. When developers flatten a nested JSON object, all keys are joined with a delimiter (e.g. user.address.city). This tool reconstructs the original nested hierarchy from those dot-notation keys — including converting numeric keys back to proper arrays.

RELATED TOOLS

FREQUENTLY ASKED QUESTIONS

What is a flattened JSON object?

A flattened JSON object is one where all nested keys are collapsed into a single level using a delimiter. For example, {"user": {"name": "Alice"}} becomes {"user.name": "Alice"}. This format is common in environment variable configs, CSV exports, and some database schemas.

How are arrays handled during unflattening?

When unflattening, numeric keys such as "tags.0", "tags.1" are automatically detected and converted into proper JSON arrays. The tool sorts numeric indexes and returns a clean array rather than an object with numeric string keys.

Can I use a delimiter other than a dot?

Yes. The tool supports dot (.), forward slash (/), underscore (_), hyphen (-), pipe (|), and colon (:) as delimiters. Simply select the one matching your flattened data before clicking Unflatten.

What if my key contains the delimiter character?

If a key naturally contains the delimiter character (e.g. a key literally named user.name that is not meant to be split), you should switch to a different delimiter that doesn't appear in your keys, or escape the keys before processing.

Does this tool send my data to a server?

Yes — the JSON is sent to our server-side PHP endpoint for processing. However, we do not store, log, or share any input data. Processing happens in real time and data is immediately discarded after the response is sent.

What is the difference between JSON Unflattener and JSON Formatter?

JSON Formatter pretty-prints or minifies existing JSON without changing its structure. JSON Unflattener actually transforms the shape of the data — turning flat dot-notation keys into a nested hierarchy. Use the Formatter after unflattening to control indentation.

What Is JSON Unflattening?

JSON unflattening is the process of restoring a flat, single-level JSON object — where all keys use a delimiter like a dot to represent hierarchy — back into its original deeply nested structure. It is the direct inverse of JSON flattening, which collapses nested objects into a flat key-value map for storage or transport purposes.

For example, a flattened JSON object might look like this:

{
  "user.name": "Alice",
  "user.age": 30,
  "user.address.city": "New York",
  "tags.0": "javascript",
  "tags.1": "php"
}

After unflattening, the same data is restored to:

{
  "user": {
    "name": "Alice",
    "age": 30,
    "address": {
      "city": "New York"
    }
  },
  "tags": ["javascript", "php"]
}

💡 Looking for premium JavaScript plugins and scripts? MonsterONE offers unlimited downloads of templates, UI kits, and developer assets — worth checking out.

Why Is JSON Flattened in the First Place?

Developers flatten JSON for several practical reasons. Environment variables, for instance, cannot represent nested structures — so a .env file or a CI/CD pipeline config often stores nested settings as DATABASE_HOST, DATABASE_PORT or using dot-notation like database.host. Similarly, some NoSQL databases, CSV exports, and flat-file storage systems require single-level key-value maps.

Redux DevTools, form serializers (like qs in Node.js), and certain API gateways also produce flattened output. When debugging or restoring this data, developers need a reliable way to reconstruct the original hierarchy — which is exactly what this tool does.

How the Unflattening Algorithm Works

The algorithm parses each key by splitting it on the chosen delimiter. It then traverses the result object, creating nested objects along the path. For example, the key a.b.c with value 42 creates {"a": {"b": {"c": 42}}}. Conflicts — where a key path tries to set both a scalar and an object at the same node — are handled by preferring the deeper path.

After building the nested object, a second pass detects numeric keys. Any sub-object whose keys are all integers and form a contiguous sequence starting at 0 is automatically promoted to a JSON array. This correctly restores arrays that were flattened as items.0, items.1, etc.

Delimiter Options Explained

Different tools and libraries use different delimiters when flattening JSON:

Common Workflows Using JSON Unflatten

Environment variable restoration: When deploying applications, it is common to inject nested config as flat env vars (e.g. APP_DB_HOST or app.db.host). This tool lets you reconstruct the full config object for local development or debugging.

Database column expansion: Some ORMs or data pipelines serialize nested JSON fields as flat columns with underscores. This tool reverses that transformation for inspection or migration.

Form data reconstruction: Libraries like PHP's parse_str, Python's werkzeug, and Node's qs serialize nested form fields using bracket or dot notation. Unflattening restores the intended structure from these serialized payloads.

API debugging: When receiving webhook payloads or flat API responses, unflattening helps you quickly visualize the logical data hierarchy without writing custom parsing code.

Tips for Best Results

Make sure your input is valid JSON — the tool validates this first and reports any parse errors with a clear message. If your keys contain the delimiter character as part of the key name itself (rather than as a hierarchy separator), switch to a less common delimiter like pipe or colon. For deeply nested structures, use the depth stat displayed after conversion to quickly understand how many levels deep the restored object goes. The tool also reports the total key count before and after unflattening, which helps verify the transformation is complete.