Cloud

Overview

Redpanda SQL provides functions to query and manipulate json data:

Functions Description

json_extract_path()

Extracts a json sub-object at the specified path.

json_extract_path_text()

Returns text referenced by a series of path elements in a json string or json body.

json_array_length()

Returns the number of elements in the outer array of a json string or json body.

json_array_extract()

Returns the json array as a set of json values.

Use operators to specify conditions when using json functions. Redpanda SQL also supports the following json operators:

Operators Description Example

Gets and returns the element of the json array.

'[{"a":"cab"},{"b":"bac"},{"c":"abc"}]'::json → 2

Gets and returns the json object field.

'{"a": {"b":"abc"}}'::json → 'a'

→>

Gets and returns the element of the json array as text.

'[11,22,33]'::json →> 2

→>

Gets and returns the json object field as text.

'{"a":13,"b":33}'::json →> 'b'