Skip to main content

When to use this

API sources often return data with multiple levels of nesting — a user object that contains an address object which itself contains a coordinates object. While Parse JSON fields works for a single level, deeply nested structures require a systematic approach to flatten everything into a single, query-friendly row.

Sample input

An events table in the Raw layer where each row has nested JSON: We want to flatten all nested fields into top-level columns.

Implementation

Use dot-notation with JSON_VALUE to traverse the nested paths.
If payload is stored as a native JSON type (not a string), you can access fields directly: payload.user.name. For string columns, JSON_VALUE is required.

Expected output


Tips and gotchas

When flattening, naming collisions can happen. If both the root and a nested object have a field called name, alias them explicitly (e.g., user_name vs event_name) to avoid ambiguity.
For very wide or deeply nested JSON (10+ fields, 3+ levels), consider flattening incrementally — create an intermediate table with the first level flattened, then flatten further in a second transformation. This makes debugging and maintenance much easier.