{"Entry":{"collection":"func","key":"json-object-agg","name":"json_object_agg","aliases":[],"metadata":{"changed_in":["17"],"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":[],"removed":[]},"status":"changed","to":"16"},{"descriptions_changed":false,"doc_overhaul":false,"from":"16","group_changed":null,"signatures":{"added":["json_object_agg ( key \"any\", value \"any\" ORDER BY input_sort_columns ) → json"],"removed":["json_object_agg ( key \"any\", value \"any\" ) → json"]},"status":"changed","to":"17"}],"content_hash":"62c1aa8fb3fb28f655e859ef904938eb47f76b328ac16fae31010b0c362b0e19","derived_content_hash":"26d2532cb1261b4ede29b3ece43512318e38e5d2932038f8d6ed524f9d73a7fc","documentation_refresh":{"batch":"20261113","original_source_rev":"wiki-repair-20261023:48abb694ec0fe423beeb96d93ff4c815292536d45567378742df042160d074e9","versions":{"14":"14.25","15":"15.20","16":"16.16","17":"17.12","18":"18.7","19":"19rc2"}},"first_version":"9.4","group":"aggregate","group_label":"Aggregate Functions","groups":["aggregate"],"imported_at":"2026-09-14T21:49:48.854477+08:00","last_version":"20","name":"json_object_agg","name_key":"json_object_agg","position":21019,"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":"639b35e4dbd3a6eb81258d9d62ee77861f3c47cdba1ec48820691e565e5cf747","repair":"wiki-repair-20261023"},"signature":"json_object_agg ( key \"any\", value \"any\" ORDER BY input_sort_columns ) → json","signature_count":1,"slug":"json-object-agg","source_rev":"wiki-repair-20261023:48abb694ec0fe423beeb96d93ff4c815292536d45567378742df042160d074e9","summary":"Collects all the key/value pairs into a JSON object.","summary_zh":""}},"Definition":{"Collection":"func","Key":"json-object-agg","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"json-object-agg","SourceRevision":"wiki-repair-20261023:48abb694ec0fe423beeb96d93ff4c815292536d45567378742df042160d074e9","Facts":{"description":"Collects all the key/value pairs into a JSON object. Key arguments are coerced to text; value arguments are converted as per to_json or to_jsonb. Values can be null, but keys cannot. If a key appears more than once, the json result keeps every pair, while the jsonb result keeps only the last value for that key.","description_html":"Collects all the key/value pairs into a JSON object. Key arguments are coerced to text; value arguments are converted as per \u003ccode class=\"function\"\u003eto_json\u003c/code\u003e or \u003ccode class=\"function\"\u003eto_jsonb\u003c/code\u003e. Values can be null, but keys cannot. If a key appears more than once, the \u003ccode class=\"type\"\u003ejson\u003c/code\u003e result keeps every pair, while the \u003ccode class=\"type\"\u003ejsonb\u003c/code\u003e result keeps only the last value for that key.","description_zh":"将所有键/值对收集到一个 JSON 对象中。键参数强制转换为文本；值参数按照 to_json 或 to_jsonb 进行转换。值可以为空，但键不能（为空）。如果一个键出现多次，json 结果会保留每个键/值对，而 jsonb 结果只保留该键的最后一个值。","description_zh_html":"将所有键/值对收集到一个 JSON 对象中。键参数强制转换为文本；值参数按照 \u003ccode class=\"function\"\u003eto_json\u003c/code\u003e 或 \u003ccode class=\"function\"\u003eto_jsonb\u003c/code\u003e 进行转换。值可以为空，但键不能（为空）。如果一个键出现多次，\u003ccode class=\"type\"\u003ejson\u003c/code\u003e 结果会保留每个键/值对，而 \u003ccode class=\"type\"\u003ejsonb\u003c/code\u003e 结果只保留该键的最后一个值。","doc":{"anchor":"FUNCTIONS-AGGREGATE-TABLE","file":"functions-aggregate.html","sha256":"31d3dcd36ef353484b4b3535f9f0d1cc239c3910146257fe5178f99b90b501e2","slug":"18"},"documentation_revision":{"inputs":[{"file":"functions-aggregate.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"31d3dcd36ef353484b4b3535f9f0d1cc239c3910146257fe5178f99b90b501e2","version":"18.7"},{"file":"functions-aggregate.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"0bf7506d27b71666fc74840a21a8f77c8a92735174f1d05033865961722e457c","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"},"group":"aggregate","group_label":"聚合函数","lang":"en","layout":"table-new","pages":["functions-aggregate.html"],"prose_only":false,"signatures":[{"description":"Collects all the key/value pairs into a JSON object. Key arguments are coerced to text; value arguments are converted as per to_json or to_jsonb. Values can be null, but keys cannot. If a key appears more than once, the json result keeps every pair, while the jsonb result keeps only the last value for that key.","description_html":"Collects all the key/value pairs into a JSON object. Key arguments are coerced to text; value arguments are converted as per \u003ccode class=\"function\"\u003eto_json\u003c/code\u003e or \u003ccode class=\"function\"\u003eto_jsonb\u003c/code\u003e. Values can be null, but keys cannot. If a key appears more than once, the \u003ccode class=\"type\"\u003ejson\u003c/code\u003e result keeps every pair, while the \u003ccode class=\"type\"\u003ejsonb\u003c/code\u003e result keeps only the last value for that key.","description_zh":"将所有键/值对收集到一个 JSON 对象中。键参数强制转换为文本；值参数按照 to_json 或 to_jsonb 进行转换。值可以为空，但键不能（为空）。如果一个键出现多次，json 结果会保留每个键/值对，而 jsonb 结果只保留该键的最后一个值。","description_zh_html":"将所有键/值对收集到一个 JSON 对象中。键参数强制转换为文本；值参数按照 \u003ccode class=\"function\"\u003eto_json\u003c/code\u003e 或 \u003ccode class=\"function\"\u003eto_jsonb\u003c/code\u003e 进行转换。值可以为空，但键不能（为空）。如果一个键出现多次，\u003ccode class=\"type\"\u003ejson\u003c/code\u003e 结果会保留每个键/值对，而 \u003ccode class=\"type\"\u003ejsonb\u003c/code\u003e 结果只保留该键的最后一个值。","examples":[],"html":"\u003ccode class=\"function\"\u003ejson_object_agg\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003ekey\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003e\"any\"\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003e\"any\"\u003c/code\u003e \u003ccode class=\"literal\"\u003eORDER BY\u003c/code\u003e \u003ccode class=\"literal\"\u003einput_sort_columns\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003ejson\u003c/code\u003e","returns":"json","text":"json_object_agg ( key \"any\", value \"any\" ORDER BY input_sort_columns ) → json","zh_from":"same-version-manual"}],"translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/functions-aggregate.html","sha256":"68da7af09e2749a855188bbbff99ae036fc7eece4e19b8e048baffd28aa3ca59"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-manual"},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-AGGREGATE-TABLE","file":"functions-aggregate.html","sha256":"31d3dcd36ef353484b4b3535f9f0d1cc239c3910146257fe5178f99b90b501e2","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"json-object-agg","SourceDatabase":"center","Version":"18","Locale":"en","Title":"json_object_agg","Summary":"Collects all the key/value pairs into a JSON object. Key arguments are coerced to text; value arguments are converted as per to_json or to_jsonb. Values can be null, but keys cannot. If a key appears more than once, the json result keeps every pair, while the jsonb result keeps only the last value for that key.","BodyHTML":"Collects all the key/value pairs into a JSON object. Key arguments are coerced to text; value arguments are converted as per \u003ccode\u003eto_json\u003c/code\u003e or \u003ccode\u003eto_jsonb\u003c/code\u003e. Values can be null, but keys cannot. If a key appears more than once, the \u003ccode\u003ejson\u003c/code\u003e result keeps every pair, while the \u003ccode\u003ejsonb\u003c/code\u003e result keeps only the last value for that key.","SourceRevision":"wiki-repair-20261023:48abb694ec0fe423beeb96d93ff4c815292536d45567378742df042160d074e9","ContentHash":"27cf2edb0863706935bf904ba0bb4b755b8f11a265789c5e37ed3e80f996f44d","Payload":{"description":"Collects all the key/value pairs into a JSON object. Key arguments are coerced to text; value arguments are converted as per to_json or to_jsonb. Values can be null, but keys cannot. If a key appears more than once, the json result keeps every pair, while the jsonb result keeps only the last value for that key.","description_html":"Collects all the key/value pairs into a JSON object. Key arguments are coerced to text; value arguments are converted as per \u003ccode class=\"function\"\u003eto_json\u003c/code\u003e or \u003ccode class=\"function\"\u003eto_jsonb\u003c/code\u003e. Values can be null, but keys cannot. If a key appears more than once, the \u003ccode class=\"type\"\u003ejson\u003c/code\u003e result keeps every pair, while the \u003ccode class=\"type\"\u003ejsonb\u003c/code\u003e result keeps only the last value for that key.","signatures":[{"description":"Collects all the key/value pairs into a JSON object. Key arguments are coerced to text; value arguments are converted as per to_json or to_jsonb. Values can be null, but keys cannot. If a key appears more than once, the json result keeps every pair, while the jsonb result keeps only the last value for that key.","description_html":"Collects all the key/value pairs into a JSON object. Key arguments are coerced to text; value arguments are converted as per \u003ccode class=\"function\"\u003eto_json\u003c/code\u003e or \u003ccode class=\"function\"\u003eto_jsonb\u003c/code\u003e. Values can be null, but keys cannot. If a key appears more than once, the \u003ccode class=\"type\"\u003ejson\u003c/code\u003e result keeps every pair, while the \u003ccode class=\"type\"\u003ejsonb\u003c/code\u003e result keeps only the last value for that key.","description_zh":"将所有键/值对收集到一个 JSON 对象中。键参数强制转换为文本；值参数按照 to_json 或 to_jsonb 进行转换。值可以为空，但键不能（为空）。如果一个键出现多次，json 结果会保留每个键/值对，而 jsonb 结果只保留该键的最后一个值。","description_zh_html":"将所有键/值对收集到一个 JSON 对象中。键参数强制转换为文本；值参数按照 \u003ccode class=\"function\"\u003eto_json\u003c/code\u003e 或 \u003ccode class=\"function\"\u003eto_jsonb\u003c/code\u003e 进行转换。值可以为空，但键不能（为空）。如果一个键出现多次，\u003ccode class=\"type\"\u003ejson\u003c/code\u003e 结果会保留每个键/值对，而 \u003ccode class=\"type\"\u003ejsonb\u003c/code\u003e 结果只保留该键的最后一个值。","examples":[],"html":"\u003ccode class=\"function\"\u003ejson_object_agg\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003ekey\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003e\"any\"\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003e\"any\"\u003c/code\u003e \u003ccode class=\"literal\"\u003eORDER BY\u003c/code\u003e \u003ccode class=\"literal\"\u003einput_sort_columns\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003ejson\u003c/code\u003e","returns":"json","text":"json_object_agg ( key \"any\", value \"any\" ORDER BY input_sort_columns ) → 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":"503c3e00cdfb4052a63871eb3ebb7a5d0dff923ccafff1edbd46a95eb25faf9a","Text":"json_object_agg ( key \"any\", value \"any\" ORDER BY input_sort_columns ) → json","Returns":"json","Payload":{"description":"Collects all the key/value pairs into a JSON object. Key arguments are coerced to text; value arguments are converted as per to_json or to_jsonb. Values can be null, but keys cannot. If a key appears more than once, the json result keeps every pair, while the jsonb result keeps only the last value for that key.","description_html":"Collects all the key/value pairs into a JSON object. Key arguments are coerced to text; value arguments are converted as per \u003ccode class=\"function\"\u003eto_json\u003c/code\u003e or \u003ccode class=\"function\"\u003eto_jsonb\u003c/code\u003e. Values can be null, but keys cannot. If a key appears more than once, the \u003ccode class=\"type\"\u003ejson\u003c/code\u003e result keeps every pair, while the \u003ccode class=\"type\"\u003ejsonb\u003c/code\u003e result keeps only the last value for that key.","description_zh":"将所有键/值对收集到一个 JSON 对象中。键参数强制转换为文本；值参数按照 to_json 或 to_jsonb 进行转换。值可以为空，但键不能（为空）。如果一个键出现多次，json 结果会保留每个键/值对，而 jsonb 结果只保留该键的最后一个值。","description_zh_html":"将所有键/值对收集到一个 JSON 对象中。键参数强制转换为文本；值参数按照 \u003ccode class=\"function\"\u003eto_json\u003c/code\u003e 或 \u003ccode class=\"function\"\u003eto_jsonb\u003c/code\u003e 进行转换。值可以为空，但键不能（为空）。如果一个键出现多次，\u003ccode class=\"type\"\u003ejson\u003c/code\u003e 结果会保留每个键/值对，而 \u003ccode class=\"type\"\u003ejsonb\u003c/code\u003e 结果只保留该键的最后一个值。","examples":[],"html":"\u003ccode class=\"function\"\u003ejson_object_agg\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003ekey\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003e\"any\"\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003e\"any\"\u003c/code\u003e \u003ccode class=\"literal\"\u003eORDER BY\u003c/code\u003e \u003ccode class=\"literal\"\u003einput_sort_columns\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003ejson\u003c/code\u003e","returns":"json","text":"json_object_agg ( key \"any\", value \"any\" ORDER BY input_sort_columns ) → json","zh_from":"same-version-manual"}}],"Spellings":null,"SQLState":null,"Evidence":null}
