Send event data that is not defined by a fixed schema.
6 minute read
This guide shows you how to use the JSON column feature while sending events to your warehouse destinations.
Overview
With RudderStack’s JSON column feature, you can:
Ingest semi-structured event data not defined by a fixed schema.
Directly store a nested event payload in your warehouse columns without worrying about the length limit.
This JSON column feature is supported for all event types (identify, track, page, screen, group) and their associated attributes/properties (context, traits, properties, etc.). You can use it to define JSON columns in any of the following scenarios:
An example that defines JSON columns for the Snowflake warehouse using the JavaScript SDK is shown:
"integrations":{"SNOWFLAKE":{// Use RS, BQ, or POSTGRES for other warehouses
"options":{"jsonPaths":["track.properties.testMap.nestedMap","track.context.ctestMap.cnestedMap"]}}}
In the above transformation, nestedMap and cnestedMap are defined as JSON columns by adding track.properties.testMap.nestedMap and track.context.ctestMap.cnestedMap in the jsonPaths list.
Then, specify the JSON path as identify.context.testMap.nestedMap, as shown:
Specifying just testMap.nestedMap would fail here because it would only apply to track events by default and not the identify events.
Important rules for jsonPaths
Note the following critical requirements for using the JSON column feature correctly:
Default behavior without event type
If you do not specify the full property path that includes the event type, for example, if you specify just testMap.nestedMap, then RudderStack applies the setting only to the properties object of track events.
Specifying event type
When you include the full path including the event type, for example, identify.context.testMap.nestedMap, RudderStack applies the setting to the specified event object (context in this case).
The objects must be present within the event—not at the top level.
Exact path matching
The property paths specified in the jsonPaths parameter must exist in the event in the exact format.
"integrations":{"All":true,"SNOWFLAKE":{// RS for Redshift, BQ for BigQuery, POSTGRES for PostgreSQL.
"options":{"jsonPaths":["track.properties.testMap.nestedMap"]}}}
Option 2: Shorthand (applies to track.properties object only)
"integrations":{"All":true,"SNOWFLAKE":{// RS for Redshift, BQ for BigQuery, POSTGRES for PostgreSQL.
"options":{"jsonPaths":["testMap.nestedMap"]}}}
"integrations":{"All":true,"SNOWFLAKE":{// RS for Redshift, BQ for BigQuery, POSTGRES for PostgreSQL.
"options":{"jsonPaths":["identify.context.testMap.nestedMap"]}}}
Using just testMap.nestedMap would fail here because it would only apply to track events by default and not the identify events.
Warehouse-specific data types
See the following guides for more information on working with semi-structured data in different warehouses and their limitations:
How does RudderStack determine a column’s data type?
RudderStack determines a column’s data type based on the first event value during the first sync.
Why aren’t my existing columns converted to JSON after enabling this feature?
The JSON column feature only applies to new columns. It does not alter or convert columns that already exist in your warehouse schema. RudderStack treats the warehouse schema as the source of truth and does not modify existing column types automatically to avoid any unintended impact on your data pipeline.
For example, if a column like cart_viewed already exists in your table, enabling the JSON column feature does not change its data type — it remains as-is.
Can I use the JSON column feature to add event properties to the tracks table?
No — the tracks table only stores contextual information (contextual fields, IDs, timestamps, etc.). Event-specific properties set via the properties key are stored in their dedicated event name tables (for example, if your track event is called button_clicked, the properties are stored in the button_clicked table). The JSON column feature does not change this behavior.
If you need specific event properties available in the tracks table for cross-event analysis, consider the following alternatives:
Use a transformation to move the required properties into the context object of your events
Create a SQL view in your warehouse that joins the tracks table with your event-specific tables on the relevant keys.
Questions? We're here to help.
Join the RudderStack Slack community or email us for support
This site uses cookies to improve your experience while you navigate through the website. Out of
these
cookies, the cookies that are categorized as necessary are stored on your browser as they are as
essential
for the working of basic functionalities of the website. We also use third-party cookies that
help
us
analyze and understand how you use this website. These cookies will be stored in your browser
only
with
your
consent. You also have the option to opt-out of these cookies. But opting out of some of these
cookies
may
have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This
category only includes cookies that ensures basic functionalities and security
features of the website. These cookies do not store any personal information.
This site uses cookies to improve your experience. If you want to
learn more about cookies and why we use them, visit our cookie
policy. We'll assume you're ok with this, but you can opt-out if you wish Cookie Settings.