statistics
json_object_agg
Build a JSON object from key-value rows; keys cannot be NULL. Duplicate keys may remain in JSON; ensure unique keys when required.
Formal Syntax & Structure
sql syntaxsql
json_object_agg(key, value)Working Example
Example Snippetsql
SELECT json_object_agg(k,v ORDER BY k) FROM (VALUES ('a',1),('b',2)) AS t(k,v);