diff --git a/doc/src/sgml/func/func-json.sgml b/doc/src/sgml/func/func-json.sgml index 0763ec81ed8..cc021e18bcb 100644 --- a/doc/src/sgml/func/func-json.sgml +++ b/doc/src/sgml/func/func-json.sgml @@ -710,15 +710,29 @@ json_object json_object ( - { key_expression { VALUE | ':' } - value_expression FORMAT JSON ENCODING UTF8 }, ... + { key_expression { VALUE | ':' } + value_expression + FORMAT JSON ENCODING UTF8 }, ... { NULL | ABSENT } ON NULL { WITH | WITHOUT } UNIQUE KEYS RETURNING data_type FORMAT JSON ENCODING UTF8 ) + + + + json_object + + json_object ( + RETURNING data_type + FORMAT JSON + ENCODING UTF8 ) + + - Constructs a JSON object of all the key/value pairs given, - or an empty object if none are given. + The first form constructs a JSON object of all the key/value pairs + given; the second form constructs an empty JSON object. + The result is of type json unless + RETURNING specifies a different type. key_expression is a scalar expression defining the JSON key, which is converted to the text type. @@ -735,6 +749,10 @@ json_object('code' VALUE 'P123', 'title': 'Jaws') {"code" : "P123", "title" : "Jaws"} + + + json_object(RETURNING jsonb) + {}