How to flatten nested json for pandas dataframe import
- Step 1Export the JSON data from your API or source — Copy or download the JSON array from your API endpoint, database query, or file. Each array element represents one DataFrame row.
- Step 2Flatten with underscore separator — Use '_' as the separator to produce Python-friendly column names. Dot notation also works with pandas but some operations like df['user.name'] require bracket notation instead of dot-accessor.
- Step 3Download the flattened JSON — Download the flattened output as a .json file or copy it to clipboard.
- Step 4Import into pandas — In Python: import json, pandas as pd; data = json.load(open('flat.json')); df = pd.DataFrame(data). All columns are now scalar types without nested dict cells, ready for analysis, groupby, or scikit-learn ingestion.
Frequently asked questions
When should I use this tool vs pandas json_normalize?+
Use pd.json_normalize() for straightforward single-level nesting where the record_path and meta parameters are known in advance. Use this tool for irregular or deep nesting where different records have different levels of nesting, making json_normalize's record_path parameter impractical to configure.
How does the flattener handle records with inconsistent structure?+
Records missing certain nested keys simply do not have those flat keys. The resulting flat array has records with different key sets. When passed to pd.DataFrame(), missing keys become NaN in the corresponding columns — matching pandas' default behavior for sparse data.
Is the API data sent to JAD Apps?+
No. Flattening runs entirely in your browser. API response payloads, ML feature values, and any PII are never transmitted to JAD Apps servers.
Privacy first
Conversion runs locally in your browser. No file is uploaded — only metadata counters are saved for signed-in dashboard stats.