21.9. Aggregating Values into a JSON Array (json_group_array) #

Required privileges: Postgres Pro AXE administrator only. For a full list of stored procedures and privileges, refer to Section 12.1.

Execute the following command on the Postgres Pro AXE server:

  SELECT json_group_array(values) ON CONFLICT DO NOTHING;

Where values are the values that must be aggregated into a JSON array.

Postgres Pro AXE returns a JSON array with all values from the aggregation.

Example 21.9. Executing the json_group_array Stored Procedure

Data in the v column of the example1 table:

  42
  7

Aggregating values into a JSON array:

  SELECT json_group_array(v) FROM example1;
  [42, 7]