JSON Parser

JSON Flatten and Unflatten Online

Flatten nested JSON into a single-level object with dot-notation keys, or unflatten dot-notation keys back into nested JSON. Useful for key-value stores, spreadsheets, environment variables and diffing. It runs in your browser.

How to flatten or unflatten JSON

  1. Choose Flatten or Unflatten.
  2. Paste your JSON. The result appears on the right immediately.
  3. Copy it, or use Swap to round-trip the output.

Flatten example

Nested JSON

{
  "user": {
    "id": 1,
    "name": "Alice",
    "tags": ["a", "b"],
    "address": { "city": "NYC" }
  },
  "active": true
}

Flattened

{
  "user.id": 1,
  "user.name": "Alice",
  "user.tags": [
    "a",
    "b"
  ],
  "user.address.city": "NYC",
  "active": true
}

Nested objects are joined with a dot, so user.address.city points at the city. Arrays are kept as values rather than being split into indexed keys.

Unflatten example

Flat JSON

{
  "a.b": 1,
  "a.c": 2,
  "d": 3
}

Unflattened

{
  "a": {
    "b": 1,
    "c": 2
  },
  "d": 3
}

Each key is split on the dot and the nested objects are rebuilt for you.

When flattening is useful

  • Loading JSON into a table, spreadsheet or CSV, which need one column per value.
  • Storing data in flat key-value systems such as Redis or environment variables.
  • Comparing two documents key by key, for example with JSON Diff.
  • Looking up a value by its path, then querying it with the JSONPath tester.

One caveat: keys that already contain a dot are ambiguous when you unflatten, because the dot is treated as a separator.

Handles JSON files up to 20MB smoothly