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_id | customer_name | customer_address_city | customer_address_zip |
|---|---|---|---|
| 123 | Jane Doe | New York | 10001 |
🛠️ How to Flatten in DataLensia
Method 1: Convert Tool (Quickest)
- Open the JSON Convert tool.
- Select JSON to CSV as the target format.
- DataLensia automatically flattens nested structures when converting to tabular formats — nested keys become dot-notation column headers (e.g.,
customer.address.city). - Download the resulting CSV.
Method 2: Visual Transform Builder
- Open the Transform Builder.
- Load your nested JSON.
- Drag the nested fields (e.g.,
customer.address.city) into the mapping area. - Define your target flat key (e.g.,
cityorcustomer_address_city). - 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.