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 is in the following format.
{ name1 : data1, name2 : data2, ..., nameN : dataN, }
If a values use to compose the JSON document is a Vantage NULL, that value is returned in the JSON instance as a JSON null.