Syntax:
JSON_ARRAYAGG(col_or_expr) [over_clause]

Aggregates a result set as a single JSON array whose elements consist
of the rows. The order of elements in this array is undefined. The
function acts on a column or an expression that evaluates to a single
value. Returns NULL if the result contains no rows, or in the event of
an error. If col_or_expr is NULL, the function returns an array of JSON
[null] elements.

As of MySQL 8.0.14, this function executes as a window function if
over_clause is present. over_clause is as described in
https://dev.mysql.com/doc/refman/8.0/en/window-functions-usage.html.

URL: https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html

