Creating JSON documents

To support applications that expect data in JSON format, Db2® provides routines for constructing, or publishing, JSON documents by using SQL.

The JSON_ARRAY scalar function generates a valid JSON array, such as [a,b,c], based on a series of values provided as input. The input values are produced by evaluating one or more SQL value expressions or queries against Db2 data objects.

The JSON_OBJECT scalar function creates a valid JSON object, such as {"a":b}, based on the "key: value" pairs that are provided as input. The input values themselves are generated from SQL value expressions.