{"Entry":{"collection":"func","key":"json-object","name":"json_object","aliases":[],"metadata":{"changed_in":["16"],"changes":[{"descriptions_changed":false,"doc_overhaul":false,"from":"9.3","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"added","to":"9.4"},{"descriptions_changed":false,"doc_overhaul":true,"from":"12","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"13"},{"descriptions_changed":true,"doc_overhaul":false,"from":"15","group_changed":null,"signatures":{"added":["json_object ( [ { key_expression { VALUE | ':' } value_expression [ FORMAT JSON [ ENCODING UTF8 ] ] }[, ...] ] [ { NULL | ABSENT } ON NULL ] [ { WITH | WITHOUT } UNIQUE [ KEYS ] ] [ RETURNING data_type [ FORMAT JSON [ ENCODING UTF8 ] ] ])"],"removed":[]},"status":"changed","to":"16"}],"content_hash":"d57935f11ef9fc98f164830ad364d01014bf1600dc884c869e4ce9725f5a0ad4","derived_content_hash":"27768d5c8e8ef4f5955515c0743afe37fcaa6d2e665960d773ea7230161e827e","documentation_refresh":{"batch":"20261113","original_source_rev":"wiki-repair-20261023:9e6bd82f8dfb9eb066aeed46495fa8b13bc3234d2f3d23b5a4e63c88e5a06017","versions":{"14":"14.25","15":"15.20","16":"16.16","17":"17.12","18":"18.7","19":"19rc2"}},"first_version":"9.4","group":"json","group_label":"Json Functions And Operators","groups":["json"],"imported_at":"2026-09-14T21:49:48.789261+08:00","last_version":"20","name":"json_object","name_key":"json_object","position":16013,"present_in":["9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"repair_provenance":{"original_source_revision":"2026-09-14T13:14:25.684213+00:00@99e6866c","receipt_sha256":"5ad9f38f0aa4b1552bb5b4d238f81f0ea84826b277b24cebad07714debdd8370","repair":"wiki-repair-20261023"},"signature":"json_object ( [ { key_expression { VALUE | ':' } value_expression [ FORMAT JSON [ ENCODING UTF8 ] ] }[, ...] ] [ { NULL | ABSENT } ON NULL ] [ { WITH | WITHOUT } UNIQUE [ KEYS ] ] [ RETURNING data_type [ FORMAT JSON [ ENCODING UTF8 ] ] ])","signature_count":3,"slug":"json-object","source_rev":"wiki-repair-20261023:9e6bd82f8dfb9eb066aeed46495fa8b13bc3234d2f3d23b5a4e63c88e5a06017","summary":"Constructs a JSON object of all the key/value pairs given, or an empty object if none are given.","summary_zh":""}},"Definition":{"Collection":"func","Key":"json-object","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"json-object","SourceRevision":"wiki-repair-20261023:9e6bd82f8dfb9eb066aeed46495fa8b13bc3234d2f3d23b5a4e63c88e5a06017","Facts":{"description":"Constructs a JSON object of all the key/value pairs given, or an empty object if none are given. key_expression is a scalar expression defining the JSON key, which is converted to the text type. It cannot be NULL nor can it belong to a type that has a cast to the json type. If WITH UNIQUE KEYS is specified, there must not be any duplicate key_expression. Any pair for which the value_expression evaluates to NULL is omitted from the output if ABSENT ON NULL is specified; if NULL ON NULL is specified or the clause omitted, the key is included with value NULL.","description_html":"Constructs a JSON object of all the key/value pairs given, or an empty object if none are given. \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e is a scalar expression defining the JSON key, which is converted to the \u003ccode class=\"type\"\u003etext\u003c/code\u003e type. It cannot be \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e nor can it belong to a type that has a cast to the \u003ccode class=\"type\"\u003ejson\u003c/code\u003e type. If \u003ccode class=\"literal\"\u003eWITH UNIQUE KEYS\u003c/code\u003e is specified, there must not be any duplicate \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e. Any pair for which the \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e evaluates to \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e is omitted from the output if \u003ccode class=\"literal\"\u003eABSENT ON NULL\u003c/code\u003e is specified; if \u003ccode class=\"literal\"\u003eNULL ON NULL\u003c/code\u003e is specified or the clause omitted, the key is included with value \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e.","description_zh":"根据给定的所有键值对构造 JSON 对象；如果没有给出键值对，则构造空对象。key_expression 是定义 JSON 键的标量表达式，会被转换为 text 类型。它不能为 NULL，其类型也不能具有到 json 的类型转换。如果指定了 WITH UNIQUE KEYS，则 key_expression 不能重复。如果指定了 ABSENT ON NULL，则 value_expression 求值为 NULL 的键值对会从输出中省略；如果指定了 NULL ON NULL 或省略了该子句，则保留该键，并将其值设为 NULL。","description_zh_html":"根据给定的所有键值对构造 JSON 对象；如果没有给出键值对，则构造空对象。\u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e 是定义 JSON 键的标量表达式，会被转换为 \u003ccode class=\"type\"\u003etext\u003c/code\u003e 类型。它不能为 \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e，其类型也不能具有到 \u003ccode class=\"type\"\u003ejson\u003c/code\u003e 的类型转换。如果指定了 \u003ccode class=\"literal\"\u003eWITH UNIQUE KEYS\u003c/code\u003e，则 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e 不能重复。如果指定了 \u003ccode class=\"literal\"\u003eABSENT ON NULL\u003c/code\u003e，则 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e 求值为 \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e 的键值对会从输出中省略；如果指定了 \u003ccode class=\"literal\"\u003eNULL ON NULL\u003c/code\u003e 或省略了该子句，则保留该键，并将其值设为 \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e。","doc":{"anchor":"FUNCTIONS-JSON-CREATION-TABLE","file":"functions-json.html","sha256":"060b67147827d70ddcf5948833ddfbeada321366476016c8b8b7d68afda8045c","slug":"18"},"documentation_revision":{"inputs":[{"file":"functions-json.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"060b67147827d70ddcf5948833ddfbeada321366476016c8b8b7d68afda8045c","version":"18.7"},{"file":"functions-json.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"31b98fa7f00387abf441728c31918bfe8b368642bceeb8bba88a73c3fbd607de","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"},"group":"json","group_label":"JSON 函数和操作符","lang":"en","layout":"table-new","pages":["functions-json.html"],"prose_only":false,"signatures":[{"description":"Constructs a JSON object of all the key/value pairs given, or an empty object if none are given. key_expression is a scalar expression defining the JSON key, which is converted to the text type. It cannot be NULL nor can it belong to a type that has a cast to the json type. If WITH UNIQUE KEYS is specified, there must not be any duplicate key_expression. Any pair for which the value_expression evaluates to NULL is omitted from the output if ABSENT ON NULL is specified; if NULL ON NULL is specified or the clause omitted, the key is included with value NULL.","description_html":"Constructs a JSON object of all the key/value pairs given, or an empty object if none are given. \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e is a scalar expression defining the JSON key, which is converted to the \u003ccode class=\"type\"\u003etext\u003c/code\u003e type. It cannot be \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e nor can it belong to a type that has a cast to the \u003ccode class=\"type\"\u003ejson\u003c/code\u003e type. If \u003ccode class=\"literal\"\u003eWITH UNIQUE KEYS\u003c/code\u003e is specified, there must not be any duplicate \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e. Any pair for which the \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e evaluates to \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e is omitted from the output if \u003ccode class=\"literal\"\u003eABSENT ON NULL\u003c/code\u003e is specified; if \u003ccode class=\"literal\"\u003eNULL ON NULL\u003c/code\u003e is specified or the clause omitted, the key is included with value \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e.","description_zh":"根据给定的所有键值对构造 JSON 对象；如果没有给出键值对，则构造空对象。key_expression 是定义 JSON 键的标量表达式，会被转换为 text 类型。它不能为 NULL，其类型也不能具有到 json 的类型转换。如果指定了 WITH UNIQUE KEYS，则 key_expression 不能重复。如果指定了 ABSENT ON NULL，则 value_expression 求值为 NULL 的键值对会从输出中省略；如果指定了 NULL ON NULL 或省略了该子句，则保留该键，并将其值设为 NULL。","description_zh_html":"根据给定的所有键值对构造 JSON 对象；如果没有给出键值对，则构造空对象。\u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e 是定义 JSON 键的标量表达式，会被转换为 \u003ccode class=\"type\"\u003etext\u003c/code\u003e 类型。它不能为 \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e，其类型也不能具有到 \u003ccode class=\"type\"\u003ejson\u003c/code\u003e 的类型转换。如果指定了 \u003ccode class=\"literal\"\u003eWITH UNIQUE KEYS\u003c/code\u003e，则 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e 不能重复。如果指定了 \u003ccode class=\"literal\"\u003eABSENT ON NULL\u003c/code\u003e，则 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e 求值为 \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e 的键值对会从输出中省略；如果指定了 \u003ccode class=\"literal\"\u003eNULL ON NULL\u003c/code\u003e 或省略了该子句，则保留该键，并将其值设为 \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e。","examples":[{"expr":"json_object('code' VALUE 'P123', 'title': 'Jaws')","result":"{\"code\" : \"P123\", \"title\" : \"Jaws\"}"}],"html":"\u003ccode class=\"function\"\u003ejson_object\u003c/code\u003e ( [\u003cspan class=\"optional\"\u003e { \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e { \u003ccode class=\"literal\"\u003eVALUE\u003c/code\u003e | ':' } \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e [\u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eFORMAT JSON\u003c/code\u003e [\u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eENCODING UTF8\u003c/code\u003e\u003c/span\u003e] \u003c/span\u003e] }[\u003cspan class=\"optional\"\u003e, ...\u003c/span\u003e] \u003c/span\u003e] [\u003cspan class=\"optional\"\u003e { \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e | \u003ccode class=\"literal\"\u003eABSENT\u003c/code\u003e } \u003ccode class=\"literal\"\u003eON NULL\u003c/code\u003e\u003c/span\u003e] [\u003cspan class=\"optional\"\u003e { \u003ccode class=\"literal\"\u003eWITH\u003c/code\u003e | \u003ccode class=\"literal\"\u003eWITHOUT\u003c/code\u003e } \u003ccode class=\"literal\"\u003eUNIQUE\u003c/code\u003e [\u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eKEYS\u003c/code\u003e\u003c/span\u003e] \u003c/span\u003e] [\u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eRETURNING\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003edata_type\u003c/code\u003e\u003c/em\u003e [\u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eFORMAT JSON\u003c/code\u003e [\u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eENCODING UTF8\u003c/code\u003e\u003c/span\u003e] \u003c/span\u003e] \u003c/span\u003e])","returns":"","text":"json_object ( [ { key_expression { VALUE | ':' } value_expression [FORMAT JSON [ENCODING UTF8] ] }[, ...] ] [ { NULL | ABSENT } ON NULL] [ { WITH | WITHOUT } UNIQUE [KEYS] ] [RETURNING data_type [FORMAT JSON [ENCODING UTF8] ] ])","zh_from":"same-version-manual"},{"description":"Builds a JSON object out of a text array. The array must have either exactly one dimension with an even number of members, in which case they are taken as alternating key/value pairs, or two dimensions such that each inner array has exactly two elements, which are taken as a key/value pair. All values are converted to JSON strings.","description_html":"Builds a JSON object out of a text array. The array must have either exactly one dimension with an even number of members, in which case they are taken as alternating key/value pairs, or two dimensions such that each inner array has exactly two elements, which are taken as a key/value pair. All values are converted to JSON strings.","description_zh":"从 text 数组构造 JSON 对象。该数组必须是一维且包含偶数个成员，此时将成员按交替的键/值对处理；或者是二维数组，且每个内部数组恰好有两个元素，将这两个元素作为一个键/值对。所有值都转换为 JSON 字符串。","description_zh_html":"从 text 数组构造 JSON 对象。该数组必须是一维且包含偶数个成员，此时将成员按交替的键/值对处理；或者是二维数组，且每个内部数组恰好有两个元素，将这两个元素作为一个键/值对。所有值都转换为 JSON 字符串。","examples":[{"expr":"json_object('{a, 1, b, \"def\", c, 3.5}')","result":"{\"a\" : \"1\", \"b\" : \"def\", \"c\" : \"3.5\"}"},{"expr":"json_object('{{a, 1}, {b, \"def\"}, {c, 3.5}}')","result":"{\"a\" : \"1\", \"b\" : \"def\", \"c\" : \"3.5\"}"}],"html":"\u003ccode class=\"function\"\u003ejson_object\u003c/code\u003e ( \u003ccode class=\"type\"\u003etext[]\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003ejson\u003c/code\u003e","returns":"json","text":"json_object ( text[] ) → json","zh_from":"same-version-manual"},{"description":"This form of json_object takes keys and values pairwise from separate text arrays. Otherwise it is identical to the one-argument form.","description_html":"This form of \u003ccode class=\"function\"\u003ejson_object\u003c/code\u003e takes keys and values pairwise from separate text arrays. Otherwise it is identical to the one-argument form.","description_zh":"这种形式的 json_object 从单独的 text 数组中成对地获取键和值。除此之外，它与单参数形式相同。","description_zh_html":"这种形式的 \u003ccode class=\"function\"\u003ejson_object\u003c/code\u003e 从单独的 text 数组中成对地获取键和值。除此之外，它与单参数形式相同。","examples":[{"expr":"json_object('{a,b}', '{1,2}')","result":"{\"a\": \"1\", \"b\": \"2\"}"}],"html":"\u003ccode class=\"function\"\u003ejson_object\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003ekeys\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext[]\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003evalues\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext[]\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003ejson\u003c/code\u003e","returns":"json","text":"json_object ( keys text[], values text[] ) → json","zh_from":"same-version-manual"}],"translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/functions-json.html","sha256":"a412feb14a229f1d9f14fa2d7735255aa297d5eb8f2971d744d9dfee659c7cca"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-manual"},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-JSON-CREATION-TABLE","file":"functions-json.html","sha256":"060b67147827d70ddcf5948833ddfbeada321366476016c8b8b7d68afda8045c","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"json-object","SourceDatabase":"center","Version":"18","Locale":"en","Title":"json_object","Summary":"Constructs a JSON object of all the key/value pairs given, or an empty object if none are given. key_expression is a scalar expression defining the JSON key, which is converted to the text type. It cannot be NULL nor can it belong to a type that has a cast to the json type. If WITH UNIQUE KEYS is specified, there must not be any duplicate key_expression. Any pair for which the value_expression evaluates to NULL is omitted from the output if ABSENT ON NULL is specified; if NULL ON NULL is specified or the clause omitted, the key is included with value NULL.","BodyHTML":"Constructs a JSON object of all the key/value pairs given, or an empty object if none are given. \u003cem\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e is a scalar expression defining the JSON key, which is converted to the \u003ccode\u003etext\u003c/code\u003e type. It cannot be \u003ccode\u003eNULL\u003c/code\u003e nor can it belong to a type that has a cast to the \u003ccode\u003ejson\u003c/code\u003e type. If \u003ccode\u003eWITH UNIQUE KEYS\u003c/code\u003e is specified, there must not be any duplicate \u003cem\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e. Any pair for which the \u003cem\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e evaluates to \u003ccode\u003eNULL\u003c/code\u003e is omitted from the output if \u003ccode\u003eABSENT ON NULL\u003c/code\u003e is specified; if \u003ccode\u003eNULL ON NULL\u003c/code\u003e is specified or the clause omitted, the key is included with value \u003ccode\u003eNULL\u003c/code\u003e.","SourceRevision":"wiki-repair-20261023:9e6bd82f8dfb9eb066aeed46495fa8b13bc3234d2f3d23b5a4e63c88e5a06017","ContentHash":"df49d80b9523fec7df05dd131140d466474d5db5227f928be8b0ee27bd22c78e","Payload":{"description":"Constructs a JSON object of all the key/value pairs given, or an empty object if none are given. key_expression is a scalar expression defining the JSON key, which is converted to the text type. It cannot be NULL nor can it belong to a type that has a cast to the json type. If WITH UNIQUE KEYS is specified, there must not be any duplicate key_expression. Any pair for which the value_expression evaluates to NULL is omitted from the output if ABSENT ON NULL is specified; if NULL ON NULL is specified or the clause omitted, the key is included with value NULL.","description_html":"Constructs a JSON object of all the key/value pairs given, or an empty object if none are given. \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e is a scalar expression defining the JSON key, which is converted to the \u003ccode class=\"type\"\u003etext\u003c/code\u003e type. It cannot be \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e nor can it belong to a type that has a cast to the \u003ccode class=\"type\"\u003ejson\u003c/code\u003e type. If \u003ccode class=\"literal\"\u003eWITH UNIQUE KEYS\u003c/code\u003e is specified, there must not be any duplicate \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e. Any pair for which the \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e evaluates to \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e is omitted from the output if \u003ccode class=\"literal\"\u003eABSENT ON NULL\u003c/code\u003e is specified; if \u003ccode class=\"literal\"\u003eNULL ON NULL\u003c/code\u003e is specified or the clause omitted, the key is included with value \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e.","signatures":[{"description":"Constructs a JSON object of all the key/value pairs given, or an empty object if none are given. key_expression is a scalar expression defining the JSON key, which is converted to the text type. It cannot be NULL nor can it belong to a type that has a cast to the json type. If WITH UNIQUE KEYS is specified, there must not be any duplicate key_expression. Any pair for which the value_expression evaluates to NULL is omitted from the output if ABSENT ON NULL is specified; if NULL ON NULL is specified or the clause omitted, the key is included with value NULL.","description_html":"Constructs a JSON object of all the key/value pairs given, or an empty object if none are given. \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e is a scalar expression defining the JSON key, which is converted to the \u003ccode class=\"type\"\u003etext\u003c/code\u003e type. It cannot be \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e nor can it belong to a type that has a cast to the \u003ccode class=\"type\"\u003ejson\u003c/code\u003e type. If \u003ccode class=\"literal\"\u003eWITH UNIQUE KEYS\u003c/code\u003e is specified, there must not be any duplicate \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e. Any pair for which the \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e evaluates to \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e is omitted from the output if \u003ccode class=\"literal\"\u003eABSENT ON NULL\u003c/code\u003e is specified; if \u003ccode class=\"literal\"\u003eNULL ON NULL\u003c/code\u003e is specified or the clause omitted, the key is included with value \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e.","description_zh":"根据给定的所有键值对构造 JSON 对象；如果没有给出键值对，则构造空对象。key_expression 是定义 JSON 键的标量表达式，会被转换为 text 类型。它不能为 NULL，其类型也不能具有到 json 的类型转换。如果指定了 WITH UNIQUE KEYS，则 key_expression 不能重复。如果指定了 ABSENT ON NULL，则 value_expression 求值为 NULL 的键值对会从输出中省略；如果指定了 NULL ON NULL 或省略了该子句，则保留该键，并将其值设为 NULL。","description_zh_html":"根据给定的所有键值对构造 JSON 对象；如果没有给出键值对，则构造空对象。\u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e 是定义 JSON 键的标量表达式，会被转换为 \u003ccode class=\"type\"\u003etext\u003c/code\u003e 类型。它不能为 \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e，其类型也不能具有到 \u003ccode class=\"type\"\u003ejson\u003c/code\u003e 的类型转换。如果指定了 \u003ccode class=\"literal\"\u003eWITH UNIQUE KEYS\u003c/code\u003e，则 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e 不能重复。如果指定了 \u003ccode class=\"literal\"\u003eABSENT ON NULL\u003c/code\u003e，则 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e 求值为 \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e 的键值对会从输出中省略；如果指定了 \u003ccode class=\"literal\"\u003eNULL ON NULL\u003c/code\u003e 或省略了该子句，则保留该键，并将其值设为 \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e。","examples":[{"expr":"json_object('code' VALUE 'P123', 'title': 'Jaws')","result":"{\"code\" : \"P123\", \"title\" : \"Jaws\"}"}],"html":"\u003ccode class=\"function\"\u003ejson_object\u003c/code\u003e ( [\u003cspan class=\"optional\"\u003e { \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e { \u003ccode class=\"literal\"\u003eVALUE\u003c/code\u003e | ':' } \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e [\u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eFORMAT JSON\u003c/code\u003e [\u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eENCODING UTF8\u003c/code\u003e\u003c/span\u003e] \u003c/span\u003e] }[\u003cspan class=\"optional\"\u003e, ...\u003c/span\u003e] \u003c/span\u003e] [\u003cspan class=\"optional\"\u003e { \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e | \u003ccode class=\"literal\"\u003eABSENT\u003c/code\u003e } \u003ccode class=\"literal\"\u003eON NULL\u003c/code\u003e\u003c/span\u003e] [\u003cspan class=\"optional\"\u003e { \u003ccode class=\"literal\"\u003eWITH\u003c/code\u003e | \u003ccode class=\"literal\"\u003eWITHOUT\u003c/code\u003e } \u003ccode class=\"literal\"\u003eUNIQUE\u003c/code\u003e [\u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eKEYS\u003c/code\u003e\u003c/span\u003e] \u003c/span\u003e] [\u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eRETURNING\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003edata_type\u003c/code\u003e\u003c/em\u003e [\u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eFORMAT JSON\u003c/code\u003e [\u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eENCODING UTF8\u003c/code\u003e\u003c/span\u003e] \u003c/span\u003e] \u003c/span\u003e])","returns":"","text":"json_object ( [ { key_expression { VALUE | ':' } value_expression [FORMAT JSON [ENCODING UTF8] ] }[, ...] ] [ { NULL | ABSENT } ON NULL] [ { WITH | WITHOUT } UNIQUE [KEYS] ] [RETURNING data_type [FORMAT JSON [ENCODING UTF8] ] ])","zh_from":"same-version-manual"},{"description":"Builds a JSON object out of a text array. The array must have either exactly one dimension with an even number of members, in which case they are taken as alternating key/value pairs, or two dimensions such that each inner array has exactly two elements, which are taken as a key/value pair. All values are converted to JSON strings.","description_html":"Builds a JSON object out of a text array. The array must have either exactly one dimension with an even number of members, in which case they are taken as alternating key/value pairs, or two dimensions such that each inner array has exactly two elements, which are taken as a key/value pair. All values are converted to JSON strings.","description_zh":"从 text 数组构造 JSON 对象。该数组必须是一维且包含偶数个成员，此时将成员按交替的键/值对处理；或者是二维数组，且每个内部数组恰好有两个元素，将这两个元素作为一个键/值对。所有值都转换为 JSON 字符串。","description_zh_html":"从 text 数组构造 JSON 对象。该数组必须是一维且包含偶数个成员，此时将成员按交替的键/值对处理；或者是二维数组，且每个内部数组恰好有两个元素，将这两个元素作为一个键/值对。所有值都转换为 JSON 字符串。","examples":[{"expr":"json_object('{a, 1, b, \"def\", c, 3.5}')","result":"{\"a\" : \"1\", \"b\" : \"def\", \"c\" : \"3.5\"}"},{"expr":"json_object('{{a, 1}, {b, \"def\"}, {c, 3.5}}')","result":"{\"a\" : \"1\", \"b\" : \"def\", \"c\" : \"3.5\"}"}],"html":"\u003ccode class=\"function\"\u003ejson_object\u003c/code\u003e ( \u003ccode class=\"type\"\u003etext[]\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003ejson\u003c/code\u003e","returns":"json","text":"json_object ( text[] ) → json","zh_from":"same-version-manual"},{"description":"This form of json_object takes keys and values pairwise from separate text arrays. Otherwise it is identical to the one-argument form.","description_html":"This form of \u003ccode class=\"function\"\u003ejson_object\u003c/code\u003e takes keys and values pairwise from separate text arrays. Otherwise it is identical to the one-argument form.","description_zh":"这种形式的 json_object 从单独的 text 数组中成对地获取键和值。除此之外，它与单参数形式相同。","description_zh_html":"这种形式的 \u003ccode class=\"function\"\u003ejson_object\u003c/code\u003e 从单独的 text 数组中成对地获取键和值。除此之外，它与单参数形式相同。","examples":[{"expr":"json_object('{a,b}', '{1,2}')","result":"{\"a\": \"1\", \"b\": \"2\"}"}],"html":"\u003ccode class=\"function\"\u003ejson_object\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003ekeys\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext[]\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003evalues\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext[]\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003ejson\u003c/code\u003e","returns":"json","text":"json_object ( keys text[], values text[] ) → json","zh_from":"same-version-manual"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":[{"Version":"18","Ordinal":0,"Hash":"bb0a83500551099d3a9ae5b6b202360f2b787453427642cbe5a3728f3bc15756","Text":"json_object ( [ { key_expression { VALUE | ':' } value_expression [FORMAT JSON [ENCODING UTF8] ] }[, ...] ] [ { NULL | ABSENT } ON NULL] [ { WITH | WITHOUT } UNIQUE [KEYS] ] [RETURNING data_type [FORMAT JSON [ENCODING UTF8] ] ])","Returns":"","Payload":{"description":"Constructs a JSON object of all the key/value pairs given, or an empty object if none are given. key_expression is a scalar expression defining the JSON key, which is converted to the text type. It cannot be NULL nor can it belong to a type that has a cast to the json type. If WITH UNIQUE KEYS is specified, there must not be any duplicate key_expression. Any pair for which the value_expression evaluates to NULL is omitted from the output if ABSENT ON NULL is specified; if NULL ON NULL is specified or the clause omitted, the key is included with value NULL.","description_html":"Constructs a JSON object of all the key/value pairs given, or an empty object if none are given. \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e is a scalar expression defining the JSON key, which is converted to the \u003ccode class=\"type\"\u003etext\u003c/code\u003e type. It cannot be \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e nor can it belong to a type that has a cast to the \u003ccode class=\"type\"\u003ejson\u003c/code\u003e type. If \u003ccode class=\"literal\"\u003eWITH UNIQUE KEYS\u003c/code\u003e is specified, there must not be any duplicate \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e. Any pair for which the \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e evaluates to \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e is omitted from the output if \u003ccode class=\"literal\"\u003eABSENT ON NULL\u003c/code\u003e is specified; if \u003ccode class=\"literal\"\u003eNULL ON NULL\u003c/code\u003e is specified or the clause omitted, the key is included with value \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e.","description_zh":"根据给定的所有键值对构造 JSON 对象；如果没有给出键值对，则构造空对象。key_expression 是定义 JSON 键的标量表达式，会被转换为 text 类型。它不能为 NULL，其类型也不能具有到 json 的类型转换。如果指定了 WITH UNIQUE KEYS，则 key_expression 不能重复。如果指定了 ABSENT ON NULL，则 value_expression 求值为 NULL 的键值对会从输出中省略；如果指定了 NULL ON NULL 或省略了该子句，则保留该键，并将其值设为 NULL。","description_zh_html":"根据给定的所有键值对构造 JSON 对象；如果没有给出键值对，则构造空对象。\u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e 是定义 JSON 键的标量表达式，会被转换为 \u003ccode class=\"type\"\u003etext\u003c/code\u003e 类型。它不能为 \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e，其类型也不能具有到 \u003ccode class=\"type\"\u003ejson\u003c/code\u003e 的类型转换。如果指定了 \u003ccode class=\"literal\"\u003eWITH UNIQUE KEYS\u003c/code\u003e，则 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e 不能重复。如果指定了 \u003ccode class=\"literal\"\u003eABSENT ON NULL\u003c/code\u003e，则 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e 求值为 \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e 的键值对会从输出中省略；如果指定了 \u003ccode class=\"literal\"\u003eNULL ON NULL\u003c/code\u003e 或省略了该子句，则保留该键，并将其值设为 \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e。","examples":[{"expr":"json_object('code' VALUE 'P123', 'title': 'Jaws')","result":"{\"code\" : \"P123\", \"title\" : \"Jaws\"}"}],"html":"\u003ccode class=\"function\"\u003ejson_object\u003c/code\u003e ( [\u003cspan class=\"optional\"\u003e { \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekey_expression\u003c/code\u003e\u003c/em\u003e { \u003ccode class=\"literal\"\u003eVALUE\u003c/code\u003e | ':' } \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e [\u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eFORMAT JSON\u003c/code\u003e [\u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eENCODING UTF8\u003c/code\u003e\u003c/span\u003e] \u003c/span\u003e] }[\u003cspan class=\"optional\"\u003e, ...\u003c/span\u003e] \u003c/span\u003e] [\u003cspan class=\"optional\"\u003e { \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e | \u003ccode class=\"literal\"\u003eABSENT\u003c/code\u003e } \u003ccode class=\"literal\"\u003eON NULL\u003c/code\u003e\u003c/span\u003e] [\u003cspan class=\"optional\"\u003e { \u003ccode class=\"literal\"\u003eWITH\u003c/code\u003e | \u003ccode class=\"literal\"\u003eWITHOUT\u003c/code\u003e } \u003ccode class=\"literal\"\u003eUNIQUE\u003c/code\u003e [\u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eKEYS\u003c/code\u003e\u003c/span\u003e] \u003c/span\u003e] [\u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eRETURNING\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003edata_type\u003c/code\u003e\u003c/em\u003e [\u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eFORMAT JSON\u003c/code\u003e [\u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eENCODING UTF8\u003c/code\u003e\u003c/span\u003e] \u003c/span\u003e] \u003c/span\u003e])","returns":"","text":"json_object ( [ { key_expression { VALUE | ':' } value_expression [FORMAT JSON [ENCODING UTF8] ] }[, ...] ] [ { NULL | ABSENT } ON NULL] [ { WITH | WITHOUT } UNIQUE [KEYS] ] [RETURNING data_type [FORMAT JSON [ENCODING UTF8] ] ])","zh_from":"same-version-manual"}},{"Version":"18","Ordinal":1,"Hash":"0e8f304a03740a52c4209af7f7878194e7aafb2d950aec44ad76e8b41c61e62c","Text":"json_object ( text[] ) → json","Returns":"json","Payload":{"description":"Builds a JSON object out of a text array. The array must have either exactly one dimension with an even number of members, in which case they are taken as alternating key/value pairs, or two dimensions such that each inner array has exactly two elements, which are taken as a key/value pair. All values are converted to JSON strings.","description_html":"Builds a JSON object out of a text array. The array must have either exactly one dimension with an even number of members, in which case they are taken as alternating key/value pairs, or two dimensions such that each inner array has exactly two elements, which are taken as a key/value pair. All values are converted to JSON strings.","description_zh":"从 text 数组构造 JSON 对象。该数组必须是一维且包含偶数个成员，此时将成员按交替的键/值对处理；或者是二维数组，且每个内部数组恰好有两个元素，将这两个元素作为一个键/值对。所有值都转换为 JSON 字符串。","description_zh_html":"从 text 数组构造 JSON 对象。该数组必须是一维且包含偶数个成员，此时将成员按交替的键/值对处理；或者是二维数组，且每个内部数组恰好有两个元素，将这两个元素作为一个键/值对。所有值都转换为 JSON 字符串。","examples":[{"expr":"json_object('{a, 1, b, \"def\", c, 3.5}')","result":"{\"a\" : \"1\", \"b\" : \"def\", \"c\" : \"3.5\"}"},{"expr":"json_object('{{a, 1}, {b, \"def\"}, {c, 3.5}}')","result":"{\"a\" : \"1\", \"b\" : \"def\", \"c\" : \"3.5\"}"}],"html":"\u003ccode class=\"function\"\u003ejson_object\u003c/code\u003e ( \u003ccode class=\"type\"\u003etext[]\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003ejson\u003c/code\u003e","returns":"json","text":"json_object ( text[] ) → json","zh_from":"same-version-manual"}},{"Version":"18","Ordinal":2,"Hash":"a0711db6b37f2679c080d59e34bbb4114846a58579c3b1e198d3743fead7a772","Text":"json_object ( keys text[], values text[] ) → json","Returns":"json","Payload":{"description":"This form of json_object takes keys and values pairwise from separate text arrays. Otherwise it is identical to the one-argument form.","description_html":"This form of \u003ccode class=\"function\"\u003ejson_object\u003c/code\u003e takes keys and values pairwise from separate text arrays. Otherwise it is identical to the one-argument form.","description_zh":"这种形式的 json_object 从单独的 text 数组中成对地获取键和值。除此之外，它与单参数形式相同。","description_zh_html":"这种形式的 \u003ccode class=\"function\"\u003ejson_object\u003c/code\u003e 从单独的 text 数组中成对地获取键和值。除此之外，它与单参数形式相同。","examples":[{"expr":"json_object('{a,b}', '{1,2}')","result":"{\"a\": \"1\", \"b\": \"2\"}"}],"html":"\u003ccode class=\"function\"\u003ejson_object\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003ekeys\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext[]\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003evalues\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext[]\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003ejson\u003c/code\u003e","returns":"json","text":"json_object ( keys text[], values text[] ) → json","zh_from":"same-version-manual"}}],"Spellings":null,"SQLState":null,"Evidence":null}
