red_json_value

RED_JSON_VALUE

Extracts a single scalar value from a JSON string or expression using JSON-Path.

  • Parameters:

    • p_string (str) – The input JSON string (e.g., '{"test": "val"}') or an expression.

    • p_expression (bool) – Set to True if p_string is an expression to be evaluated.

    • p_json_path (str) – The JSON-Path to the desired value (e.g., '$.test').

  • returns: str – The extracted value as a string, or NULL if the path is not found.

  • raises RequestException: In case of invalid JSON or execution errors.

Examples

Basic value extraction

1select RED_JSON_VALUE('{"test": "dd"}', false, '$.test') as result;

Extraction from a nested object

1select RED_JSON_VALUE('{"user": {"id": 123}}', false, '$.user.id') as user_id;