Flatten json object
Description
The Flatten Json Object activity transforms JSON strings stored in column(s) into individual fields. It parses and expands nested properties from the selected columns, appending the new keys as new columns to the dataset.
Use Case
Often used when JSON data is stored in a single column (e.g., API responses, logs). This activity extracts nested keys into flat columns for easier filtering, analysis, or mapping in downstream steps.
Input
Type | Description |
---|---|
Data | Dataset with one or more JSON columns. |
Output
Type | Description |
---|---|
Transformed Data | Original dataset with JSON fields expanded into columns. |
Configuration Fields
Field Name | Required | Description |
---|---|---|
Columns | Yes | List of column(s) containing JSON objects to be flattened. |
Sample Input
employee_id | name | age | contact |
---|---|---|---|
E001 | John Doe | 32 | {“email”:“[email protected]”, “phone”:“+1-555-1234”} |
E002 | Jane Smith | 28 | {“email”:“[email protected]”, “phone”:“+1-555-5678”} |
E003 | Ali Khan | 40 | {“email”:“[email protected]”, “phone”:“+1-555-9876”} |
E004 | Maria Gonzalez | 35 | {“email”:“[email protected]”, “phone”:“+1-555-2468”} |
E005 | Rahul Sharma | 30 | {“email”:“[email protected]”, “phone”:“+1-555-7890”} |
Sample Configuration
Field | Value |
---|---|
Columns | contact |
Sample Output
employee_id | name | age | contact | contact_email | contact_phone |
---|---|---|---|---|---|
E001 | John Doe | 32 | {“email”:“[email protected]”, “phone”:“+1-555-1234”} | [email protected] | +1-555-1234 |
E002 | Jane Smith | 28 | {“email”:“[email protected]”, “phone”:“+1-555-5678”} | [email protected] | +1-555-5678 |
E003 | Ali Khan | 40 | {“email”:“[email protected]”, “phone”:“+1-555-9876”} | [email protected] | +1-555-9876 |
E004 | Maria Gonzalez | 35 | {“email”:“[email protected]”, “phone”:“+1-555-2468”} | [email protected] | +1-555-2468 |
E005 | Rahul Sharma | 30 | {“email”:“[email protected]”, “phone”:“+1-555-7890”} | [email protected] | +1-555-7890 |
The new columns will be named based on the original column name and the JSON key (e.g.,
contact_email
,contact_phone
).