MySQL 8.0 Reference Manual Including MySQL NDB Cluster 8.0

12.17.2 Functions That Create JSON Values

The functions listed in this section compose JSON values from component elements.

You can also obtain JSON values by casting values of other types to the JSON type using CAST(value AS JSON); see Converting between JSON and non-JSON values, for more information.

Two aggregate functions generating JSON values are available. JSON_ARRAYAGG() returns a result set as a single JSON array, and JSON_OBJECTAGG() returns a result set as a single JSON object. For more information, see Section 12.20, “Aggregate (GROUP BY) Functions”.