SQL, parse json data #eg28
Judy

Judy @esproc_spl

About: Like open source, follow open source

Joined:
Oct 23, 2023

SQL, parse json data #eg28

Publish Date: Aug 20 '24
11 0

In Google BigQuery database, data table stores a number of multilayer JSON strings. Below is one of them:

[{"active":true,"key":"key1","values":[{"active":true,"value":"value1"}]},{"active":true,"key":"key2","values":[{"active":true,"value":"value2"}]}]
Enter fullscreen mode Exit fullscreen mode

We need to parse the JSON strings and get all values under values.values field. Take the above JSON string as an example, the expected result is value1,value2.

Write the following SPL code:
Image description
A1: Run the simple SQL statement to retrieve JSON strings.

A2: Parse the multilayer strings and get all values of values.value.

Source

SPL open source address

Comments 0 total

    Add comment