All Products
Search
Document Center

Realtime Compute for Apache Flink:JSON_TUPLE

Last Updated:Feb 06, 2026

This topic describes how to use the JSON_TUPLE function to extract values from a JSON string by specifying paths.

Limits

The JSON_TUPLE function is supported only in Ververica Runtime (VVR) 3.0.0 and later.

Syntax

JSON_TUPLE(str, path1, path2 ..., pathN)     

Input parameters

Parameter

Data type

Description

str

VARCHAR

A JSON string.

path1 to pathN

VARCHAR

A string that represents a path. Do not include $ at the start.

Examples

  • Test data

    Table 1. T1

    d(VARCHAR)

    s(VARCHAR)

    {"qwe":"asd","qwe2":"asd2","qwe3":"asd3"}

    qwe3

    {"qwe":"asd4","qwe2":"asd5","qwe3":"asd3"}

    qwe2

  • Test statement

    SELECT d, v 
    FROM T1, lateral table(JSON_TUPLE(d, 'qwe', s))
    AS T(v);   
  • Test result

    d(VARCHAR)

    v(VARCHAR)

    {"qwe":"asd","qwe2":"asd2","qwe3":"asd3"}

    asd

    {"qwe":"asd","qwe2":"asd2","qwe3":"asd3"}

    asd3

    {"qwe":"asd4","qwe2":"asd5","qwe3":"asd3"}

    asd4

    {"qwe":"asd4","qwe2":"asd5","qwe3":"asd3"}

    asd5

Change in NULL value handling behavior

Behavior comparison

Assume that you invoke the function in the query json_tuple(CAST(NULL AS STRING), 'a', 'b'), where the `str` input parameter is NULL.

SELECT * FROM (VALUES (1), (2)) AS v(x)
, LATERAL TABLE(
  json_tuple(CAST(NULL AS STRING), 'a', 'b')
) AS T;
-- Each input row returns two rows with NULL. Total: 4 rows — (1,null), (1,null), (2,null), (2,null)
  • Before VVR 11.0 (legacy behavior)

    • Result: Four rows.

    • Content: Each row contains one NULL column.

  • VVR 11.0 and later (new behavior)

    • Result: Zero rows (empty set).

    • Content: None.