DB2 Scalar functions - JSON_QUERY
The JSON_QUERY function returns an SQL/JSON value from the specified JSON text by using an SQL/JSON path expression.
Although the schema for this function is SYSIBM, the function cannot be specified as a qualified name.
If a character value is returned, it must contain correctly formatted JSON data (SQLSTATE 22032). If a binary data type is returned, it is interpreted according to the explicit or implicit FORMAT clause.
If JSON-expression is a character string data type, it is treated as JSON data.
If JSON-expression is a binary string data type, it is interpreted as UTF-8 data.
See CREATE TABLE statement for the description of built-in data types.
The result can be null. If JSON-expression is null, the result is the null value.
VALUES JSON_QUERY('{"id":"701", "name":{"first":"John", "last":"Doe"}}', '$.name');
{"first":"John", "last":"Doe"}
See the example at sql-json-path-expression for different array wrapper options with JSON_QUERY.