DB2 Scalar functions - JSON_VALUE
The JSON_VALUE function returns an SQL scalar value from 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_VALUE('{"id":"987"}', 'strict $.id' RETURNING INTEGER));
The result is 987.
VALUES (JSON_VALUE('{"pay":{"salary":94250.00,"bonus":800.00,"comm":3300.00}}', 'strict $.pay.bonus' RETURNING INTEGER));