json

jsonb_build_object

Constructs a jsonb object; duplicate keys retain the last value.

Formal Syntax & Structure

sql syntaxsql
jsonb_build_object(key, value, ...)

Working Example

Example Snippetsql
SELECT jsonb_build_object('id', 1, 'id', 7);
SQL Reference