Flexible Queries with Nested Fields

Working with semi-structured data types using nested fields in Kubit.

Introduction

When working with JSON or BigQuery Struct types, such as user_properties and event_params for Firebase data, the Nested Property feature allows you to access internal properties for use in Filter, Breakdown, or Function. This is particularly useful for experimenting with new data captured dynamically.

Keep in mind that using Nested Property requires technical knowledge, and analyses may not perform as quickly as when properties are exposed as first-class fields.

Requirements to Use Nested Fields

  • Available exclusively to Kubit Enterprise customers.
  • Requires understanding of the internal data structure of JSON or Struct fields.
  • Advanced users should be familiar with JSON Path for JSON fields.

How to Use a Nested Field

  1. Select a Nested Field in Filter, Breakdown, or Function Property. Kubit denotes a Nested Field with [:] before the field name.
  2. Click the field to expand available JSON top-level keys.
    • Most fields are auto-cast to STRING data types.
    • To change the data type, hover over the JSON top-level key and select the desired type from the dropdown.
  1. After selecting the JSON Key, choose your operator (if using as a filter) or continue building and execute your report.

Using Nested Fields as Filters

Kubit populates each top-level Key value with the most popular values for easier filtering.

If the list of values is outdated, use the Event Field Value refresh button at the bottom of the field value dropdown in the filter widget.

Advanced Use Cases for Nested Fields

To access multiple levels of a JSON field, type the path you want Kubit to traverse. Syntax may vary depending on your Cloud Data Warehouse, but here's an example in BigQuery:

To retrieve the value from the second level of a JSON field called 'Device Properties', type locale.state[1] to access the value in the 2nd position of the state array within this object.

Steps to follow:

  1. Navigate to your JSON field.
  2. Hover over the field name and select a Custom JSON Path in the right-hand panel.
  3. Enter your JSON path and specify the location within an Array if needed.
    • The JSON Nested Field feature retrieves one value from the field.
  4. Select the data type.
  5. If using as a filter, select your filter operator and enter the value manually.