Several Fivetran connectors deliver data to your warehouse in JSON format, but only give the option to unpack one layer of columns.
You want to flatten JSON fields, below the first layer, into their own columns in Snowflake.
Your cloud warehouse is Snowflake.
In this example, the Fivetran webhooks connector delivers JSON data to a column named data in your warehouse:
The JSON data is:
"name": "John Smith"
"name": "Jane Doe"
To bring the user’s name and email fields into their own columns you can set up a transformation to flatten the JSON into a view.
- Open Fivetran
- Click Transformations
- Click + Transformation
- Provide a Name
- In the SQL Script add the following lines:
USE SCHEMA webhooks;
CREATE OR REPLACE VIEW users_unpacked AS (
value:name::STRING as name,
value:email::STRING as email,
lateral flatten(input => data:users)
- Select New Data or Time Scheduled
- Click Save and Run
The result in the newly created view in Snowflake is a row per user with the email and name in their own columns: