Navigation

Flatten Nested JSON

Learn how to transform complex, deeply nested JSON structures into flat, tabular formats for easier analysis.

Last updated:

Hierarchical JSON data is great for storage but often difficult to analyze or export to tabular formats like CSV or SQL. DataLensia makes it straightforward to flatten these structures.

🚩 The Problem

Imagine you have a dataset like this:

{
  "order_id": "123",
  "customer": {
    "name": "Jane Doe",
    "address": {
      "city": "New York",
      "zip": "10001"
    }
  }
}

Standard analytics tools prefer:

order_idcustomer_namecustomer_address_citycustomer_address_zip
123Jane DoeNew York10001

🛠️ How to Flatten in DataLensia

Method 1: Convert Tool (Quickest)

  1. Open the JSON Convert tool.
  2. Select JSON to CSV as the target format.
  3. DataLensia automatically flattens nested structures when converting to tabular formats — nested keys become dot-notation column headers (e.g., customer.address.city).
  4. Download the resulting CSV.

Method 2: Visual Transform Builder

  1. Open the Transform Builder.
  2. Load your nested JSON.
  3. Drag the nested fields (e.g., customer.address.city) into the mapping area.
  4. Define your target flat key (e.g., city or customer_address_city).
  5. DataLensia will apply the transformation to every record and produce the flattened output.

🚀 Try it now

Open the Convert Tool, paste your nested JSON, and select CSV to see an automatically flattened representation.