PlayWithJSON

JSON Flattener & Unflattener

Dot Notation

Flatten deep nested JSON objects into flat dot-notation keys or unflatten flat keys back to nested JSON trees.

Samples:
Action:
Delimiter:
Indent:
JSON / JSON5 InputJSON
23 lines | 387 charsJSON
Processed JSON OutputJSON
{
  "id": 101,
  "user.name.first": "Asha",
  "user.name.last": "Sharma",
  "user.contact.email": "asha@example.com",
  "user.contact.phone": "+91-9876543210",
  "user.roles.0": "admin",
  "user.roles.1": "editor",
  "user.address.city": "Jaipur",
  "user.address.state": "Rajasthan",
  "user.address.geo.lat": 26.9124,
  "user.address.geo.lng": 75.7873,
  "active": true
}
14 lines | 373 charsJSON

JSON Flattener & Unflattener Online - Dot Notation Converter

Quickly flatten deeply nested JSON structures into clean, single-level key-value pairs using dot notation, underscore, slash, or bracket syntax. Or reverse the process to unflatten flat keys back into full nested JSON trees.

Essential for exporting JSON data into flat spreadsheets, CSVs, relational databases, Elasticsearch, Kibana, and BigQuery tables. Operates 100% in your browser for absolute data confidentiality.

{}

Why Use PlayWithJSON?

  • Bidirectional: Flatten nested JSON or Unflatten dot notation back to objects
  • Custom delimiters: Dot (.), Underscore (_), Slash (/), and Bracket ([key])
  • Array handling: Flatten array elements or keep arrays intact as values
  • Automatic array reconstruction from numeric path keys (e.g., items.0, items.1)
  • 100% client-side execution keeping confidential data secure

Key Features of JSON Flattener & Unflattener

Bidirectional Flatten & Unflatten

Switch between Flatten (deep to single-level) and Unflatten (flat keys to nested tree) with one click.

Multiple Delimiter Styles

Choose standard dot notation (user.name), underscore (user_name), slash (user/name), or bracket (user[name]).

Smart Array Reconstruction

Unflattening accurately converts numbered index keys (e.g. items.0, items.1) back into real JSON arrays.

Depth Control

Optionally preserve arrays or limit flattening depth to keep certain sub-trees together.

JSON5 Support

Handles trailing commas, comments, and unquoted keys in input data seamlessly.

Instant Copy & Download

Copy the transformed JSON immediately or download it as a ready-to-use .json file.

How to Flatten or Unflatten JSON Online

1

Paste JSON Data

Paste nested JSON or flat dot-notation keys into the input editor.

2

Choose Mode

Select "Flatten" to flatten nested structures or "Unflatten" to restore nested trees.

3

Customize Delimiter

Pick Dot, Underscore, Slash, or Bracket syntax according to your target tool.

4

Copy or Download

Copy the output or download it as flattened_data.json.

JSON Flattening Example

Nested JSON (Input)
{ "user": { "name": "Asha", "address": { "city": "Jaipur", "geo": { "lat": 26.91 } } } }
Flattened Output (Dot Notation)
1{
2 "user.name": "Asha",
3 "user.address.city": "Jaipur",
4 "user.address.geo.lat": 26.91
5}

Data Structure Support

Invalid JSON
1{
2 "user.name": "Asha" // trailing comma error
3,}
Syntax error: invalid JSON comma positioning
Valid Nested or Flat JSON
1{
2 "user.profile.bio": "Software Architect"
3}

Supported Capabilities

Deep recursive object flattening
Reversible unflattening into nested trees
Custom delimiters (., _, /, [])
Array flattening with index preservation
Automatic consecutive index array reconstruction
Max depth limits for partial flattening
Custom indentation (2 or 4 spaces)
Real-time error pinpointing
100% private in-browser processing
Frequently Asked Questions

Frequently Asked Questions about JSON Flattener

Flat JSON is required by tabular tools such as CSV exporters, Excel spreadsheets, Google BigQuery, SQL tables, and analytics systems that cannot easily ingest arbitrary nested object trees.

More JSON Developer Tools

View All Tools

JSON Formatter

Format, validate and inspect JSON data

JSON5 Formatter

Format and validate JSON5 with comments

JSON ↔ JSON5

Convert between JSON and modern JSON5

JSON to TypeScript

Generate TypeScript interfaces from JSON

JSON to Zod

Generate Zod schemas from JSON

Text to JSON

Convert text and schemas into structured JSON

JSON Sorter Online

Sort JSON keys alphabetically and order arrays

JWT Decoder Online

Decode JWT header, payload and expiration

JSON Stringify Online

Escape quotes and stringify or unescape JSON

Mock JSON Generator

Generate realistic mock data for APIs and testing

JSON to CSV

Export structured JSON arrays into CSV spreadsheets

JSONPath Tester

Query and filter JSON data with path expressions

JSON Schema Generator

Generate JSON Schema from sample JSON

JSON Diff & Compare

Compare two JSON objects and find differences

JSON ↔ YAML

Convert JSON/JSON5 to YAML and back with comments

JSON ↔ XML

Convert JSON to XML and XML to JSON with attributes

YAML to CSV

Convert YAML lists and objects into spreadsheets

CSV to JSON / JSON5

Convert CSV/TSV to JSON or JSON5 with type parsing

JSON to BigQuery

Generate BigQuery Schema JSON and CREATE TABLE DDL

JSON to GraphQL

Generate GraphQL SDL types, queries, and inputs

JSON to MySQL

Generate MySQL CREATE TABLE DDL and INSERT queries

JSON to PostgreSQL

Generate PostgreSQL CREATE TABLE DDL, JSONB and INSERTs

JSON Flattener

Flatten nested JSON to dot notation or unflatten back

JSON Tree Visualizer

Interactive SVG mindmap graph and collapsible node tree

JSON Minifier Online

Compact and compress JSON by stripping whitespace

JSON Token Counter

Calculate LLM tokens (GPT-4o, Claude) and API costs

Broken JSON Repair

Automatically heal broken and truncated AI/LLM JSON