# JSON Unflattener

Convert flattened key-value pairs back to nested JSON objects with support for different key formats and data type inference

> Canonical page: https://test.elysiatools.com/en/tools/json-unflattener

- **Category:** Data Processing

- **Keywords:** json, unflatten, nested, object, reconstruct, key-value, restore

## Overview

The JSON Unflattener tool allows you to instantly convert flattened key-value pairs or dot-notation strings back into structured, nested JSON objects. It is designed to help developers and data analysts reconstruct complex data hierarchies from flat exports, CSVs, or configuration files with ease.

## Inputs

- **Flattened Data Input** (textarea): Enter your flattened key-value pairs...
- **Input Format** (select)
- **Key Format** (select)
- **Key Delimiter** (text): Character separating nested keys
- **Data Type Inference** (select)
- **Array Detection** (select)
- **Merge Strategy for Conflicts** (select)
- **Preserve Empty/Null Values** (checkbox)

## When to use

- Reconstructing nested JSON objects from flat database exports or CSV files.
- Converting dot-notation configuration strings into readable hierarchical JSON structures.
- Standardizing inconsistent data formats by parsing flattened keys into a clean, nested schema.

## How it works

- Paste your flattened data into the input area and select your input format (JSON or Key=Value).
- Choose the appropriate key format (e.g., Dot Notation, Bracket, or Path) to match your input structure.
- Configure data type inference and array detection settings to ensure the output matches your expected schema.
- Click process to generate and download your fully nested, structured JSON object.

## Use cases

- Transforming flat environment variable exports into nested application configuration files.
- Rebuilding complex API response objects from flattened log data for debugging purposes.
- Cleaning up exported spreadsheet data that uses dot-notation headers to represent nested object properties.

## Frequently asked questions

### What input formats are supported?

You can provide input as a flat JSON object or as a list of Key=Value pairs, one per line.

### How does the tool handle arrays?

The tool supports numeric keys (e.g., user.0, user.1) or bracket notation (e.g., user[0], user[1]) to automatically detect and reconstruct arrays.

### Can it automatically detect data types?

Yes, the 'Auto-detect' and 'Smart' inference modes automatically convert strings into numbers, booleans, or null values where applicable.

### What happens if there are conflicting keys?

You can choose a merge strategy: override the existing value, merge objects/arrays, or trigger an error if a conflict is detected.

### Is my data processed on a server?

The tool performs processing locally in your browser, ensuring your data remains private and secure.

## Related tools

- [JSON Data Lineage Tracer](https://test.elysiatools.com/en/tools/json-data-lineage-tracer): Trace JSON field paths, derived dependencies, and transformation history to build a field-level lineage graph
- [JSON Key Renamer](https://test.elysiatools.com/en/tools/json-key-renamer): Batch rename JSON object keys with support for patterns, rules, and transformations. Perfect for API response formatting and data normalization.
- [BOM Character Remover](https://test.elysiatools.com/en/tools/data-bom-remover): Remove BOM (Byte Order Mark) characters from text and file content. Perfect for cleaning up text files that have encoding issues, fixing CSV imports, and preparing data for processing. Features: - Detect and remove UTF-8 BOM (EF BB BF) - Detect and remove UTF-16 BOM (FE FF or FF FE) - Detect and remove UTF-32 BOM (00 00 FE FF or FF FE 00 00) - Support multiple input formats - Visual BOM character display - Detailed detection report - Support for batch text processing Common Use Cases: - Fix CSV file import errors - Clean up text file encoding issues - Prepare data for JSON parsing - Fix XML parsing problems - Resolve API data encoding conflicts - Standardize text data format
- [JSON Key Extractor](https://test.elysiatools.com/en/tools/json-key-extractor): Extract all keys from JSON objects with multiple output formats. Perfect for analyzing JSON structure, documentation generation, and understanding complex nested objects.
- [Object Key-Value Converter](https://test.elysiatools.com/en/tools/object-key-value-converter): Convert between different object key-value formats and manipulate object structures
- [CSV to JSON Converter](https://test.elysiatools.com/en/tools/csv-to-json): Convert CSV data to JSON format with customizable parsing options
- [Excel to JSON Converter](https://test.elysiatools.com/en/tools/excel-to-json): Convert Excel file to JSON format, extracting data from the first worksheet
- [Lodash Online Utility](https://test.elysiatools.com/en/tools/lodash-online-utility): Run a safe, curated set of Lodash helpers on JSON input.

## Samples

- [JSON Samples](https://test.elysiatools.com/en/samples/json): JSON (JavaScript Object Notation) format examples from simple to complex structures
- [Terraform Plan JSON Samples](https://test.elysiatools.com/en/samples/terraform-plan-json-samples): Sample Terraform plan JSON files exported from terraform show -json style payloads for dependency visualization and change review
- [Chat Transcript JSON Samples](https://test.elysiatools.com/en/samples/chat-transcript-json): JSON examples for multi-role chat transcripts
- [Rich Media JSON Samples](https://test.elysiatools.com/en/samples/rich-media-json): JSON examples for popular rich text editors (TipTap, Quill, Slate)

## Related content

- [JSON Structure Surgery](https://test.elysiatools.com/en/hubs/json-structure-surgery): Operate on JSON structure with a record of every cut — inventory the key paths before touching anything, address nodes precisely with RFC 6901 pointers or flexibly with JSONPath, rename keys by rule instead of by hand, apply RFC 6902 patches as an auditable operation sequence, and flatten to travel with a lossless way back.
