By default, JSON_AGG returns a JSON document in character set UNICODE and a maximum length of 32000 UNICODE characters (64000 bytes), unless otherwise specified with the optional RETURNS clause.
A hierarchical relationship is not possible with this function. The resulting JSON instance is flat, with each input parameter corresponding to one child of the result. The resulting document will be in the following format.
{ name1 : data1, name2 : data2, ..., nameN : dataN, }
If one of the values used to compose the JSON document is a Vantage NULL, it is returned in the JSON instance as a JSON null.