JSON Flatten

Flatten nested JSON into a single level with keys like user.address.city, using any separator.

Processed on your device. Files are not uploaded

How to flatten nested JSON

  1. Paste your nested JSON

    Paste or type it into the box, or press Try an example.

  2. Choose the separator

    A dot is the default, giving keys like a.b.c.

  3. Copy or download

    Use the flat object where nested data is not allowed, such as a spreadsheet.

Worked example

This is what JSON Flatten gives for its own sample values. Open the tool above and change anything to try your own.

Nested JSON

{
  "name": "sarva-tools",
  "version": "1.2.0",
  "private": true,
  "author": { "name": "Ada", "email": "ada@example.com" },
  "keywords": ["tools", "developer"],
  "scripts": { "build": "next build", "test": "vitest run" }
}
Separator
.
Indentation
2 spaces

Flat JSON

{
  "name": "sarva-tools",
  "version": "1.2.0",
  "private": true,
  "author.name": "Ada",
  "author.email": "ada@example.com",
  "keywords.0": "tools",
  "keywords.1": "developer",
  "scripts.build": "next build",
  "scripts.test": "vitest run"
}

About JSON Flatten

Flatten nested JSON into one level of keys such as user.address.city. Lists use their index, so tags.0 is the first tag. The result is easy to load into a table or a key-value store.

FAQs

Can I use another separator?

Yes. Slash, underscore or anything you like.

What about empty objects and lists?

They are kept as empty values.

Can I undo it?

Use JSON Unflatten.

Related tools