JSON Flatten Converter

Flatten nested JSON into a flat key-value structure.

Category: Converters

When to use?

Use it to flatten nested JSON into dot-notation keys for logs, analytics events, or spreadsheet input.

How to use

  • Paste nested JSON.
  • Check the dot-notation key-value result.
  • Copy the result.

Input Explanation

Enter an object or array at the root. Array indices become path segments such as 0, 1, 2. Rename empty keys or keys that would produce duplicate dotted paths before converting.

Calculation Basis

It recursively traverses objects and arrays, mapping leaf values to dot-path keys.

Usage Examples

  • Tidy analytics data - Flatten nested structures for easier CSV or log analysis.
  • Prepare spreadsheet input - Turn nested JSON into flat key-value for a table.
  • Compare configs - Flatten nested settings to compare two JSONs key by key.

Examples

  • {"user":{"name":"Bling"}} → {"user.name":"Bling"}
  • Deeply nested {"a":{"b":{"c":1}}} → {"a.b.c":1}

Cautions

  • Duplicate dotted paths and empty keys stop conversion to prevent lost values. The root must be an object or array.
  • Malformed source data can cause parsing errors or broken output.
  • A mismatched encoding standard or complex nested data may break or drop the structure.

FAQ

How are arrays shown?

Array indices are included in the key path. E.g. roles.0

What is the flattened key format?

Dot notation joining nesting levels with periods. E.g. user.address.city

Can I restore the nested structure?

This tool focuses on flattening. To restore, reassemble by key path.

What about empty objects or arrays?

Nested empty objects and arrays are preserved at their paths. For example, {"roles":[]} remains {"roles":[]}.

Related Tools