{"Entry":{"collection":"func","key":"json","name":"json","aliases":[],"metadata":{"changed_in":[],"changes":[{"descriptions_changed":false,"doc_overhaul":false,"from":"10","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"added","to":"11"},{"descriptions_changed":false,"doc_overhaul":false,"from":"12","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"removed","to":"13"},{"descriptions_changed":false,"doc_overhaul":false,"from":"16","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"added","to":"17"}],"content_hash":"a77e99b3ac588b6d82bdc84f23cd0d3aa1a41681ead9851e68c0362f80d6ab4b","derived_content_hash":"e7595373bd45bc96173a81303da11e78a888013c711752abf906f07ca196aa40","documentation_refresh":{"batch":"20261113","original_source_rev":"wiki-repair-20261023:21f6bdb05206dd9442b7eb04aec9b3cdb2154f24c08ce397dd8697c4898d410d","versions":{"17":"17.12","18":"18.7","19":"19rc2"}},"first_version":"11","group":"json","group_label":"Json Functions And Operators","groups":["textsearch","json"],"imported_at":"2026-09-14T21:49:48.780656+08:00","last_version":"20","name":"json","name_key":"json","position":16001,"present_in":["11","12","17","18","19","20"],"repair_provenance":{"original_source_revision":"2026-09-14T13:14:25.684213+00:00@99e6866c","receipt_sha256":"8d41aca550a633be0b8f5889b56ea863022a297b5435b16e173158bf767d53e0","repair":"wiki-repair-20261023"},"signature":"json ( expression [ FORMAT JSON [ ENCODING UTF8 ]] [ { WITH | WITHOUT } UNIQUE [ KEYS ]] ) → json","signature_count":1,"slug":"json","source_rev":"wiki-repair-20261023:21f6bdb05206dd9442b7eb04aec9b3cdb2154f24c08ce397dd8697c4898d410d","summary":"Converts a given expression specified as text or bytea string (in UTF8 encoding) into a JSON value.","summary_zh":""}},"Definition":{"Collection":"func","Key":"json","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"json","SourceRevision":"wiki-repair-20261023:21f6bdb05206dd9442b7eb04aec9b3cdb2154f24c08ce397dd8697c4898d410d","Facts":{"description":"Converts a given expression specified as text or bytea string (in UTF8 encoding) into a JSON value. If expression is NULL, an SQL null value is returned. If WITH UNIQUE is specified, the expression must not contain any duplicate object keys.","description_html":"Converts a given expression specified as \u003ccode class=\"type\"\u003etext\u003c/code\u003e or \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e string (in UTF8 encoding) into a JSON value. If \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e is NULL, an SQL null value is returned. If \u003ccode class=\"literal\"\u003eWITH UNIQUE\u003c/code\u003e is specified, the \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e must not contain any duplicate object keys.","description_zh":"将给定的 text 或 bytea 字符串表达式（采用 UTF8 编码）转换为 JSON 值。如果 expression 为 NULL，则返回 SQL 空值。如果指定了 WITH UNIQUE，则 expression 不能包含重复的对象键。","description_zh_html":"将给定的 \u003ccode class=\"type\"\u003etext\u003c/code\u003e 或 \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e 字符串表达式（采用 UTF8 编码）转换为 JSON 值。如果 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e 为 NULL，则返回 SQL 空值。如果指定了 \u003ccode class=\"literal\"\u003eWITH UNIQUE\u003c/code\u003e，则 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\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":"Converts a given expression specified as text or bytea string (in UTF8 encoding) into a JSON value. If expression is NULL, an SQL null value is returned. If WITH UNIQUE is specified, the expression must not contain any duplicate object keys.","description_html":"Converts a given expression specified as \u003ccode class=\"type\"\u003etext\u003c/code\u003e or \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e string (in UTF8 encoding) into a JSON value. If \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e is NULL, an SQL null value is returned. If \u003ccode class=\"literal\"\u003eWITH UNIQUE\u003c/code\u003e is specified, the \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e must not contain any duplicate object keys.","description_zh":"将给定的 text 或 bytea 字符串表达式（采用 UTF8 编码）转换为 JSON 值。如果 expression 为 NULL，则返回 SQL 空值。如果指定了 WITH UNIQUE，则 expression 不能包含重复的对象键。","description_zh_html":"将给定的 \u003ccode class=\"type\"\u003etext\u003c/code\u003e 或 \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e 字符串表达式（采用 UTF8 编码）转换为 JSON 值。如果 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e 为 NULL，则返回 SQL 空值。如果指定了 \u003ccode class=\"literal\"\u003eWITH UNIQUE\u003c/code\u003e，则 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e 不能包含重复的对象键。","examples":[{"expr":"json('{\"a\":123, \"b\":[true,\"foo\"], \"a\":\"bar\"}')","result":"{\"a\":123, \"b\":[true,\"foo\"], \"a\":\"bar\"}"}],"html":"\u003ccode class=\"function\"\u003ejson\u003c/code\u003e ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\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 { \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] ) → \u003ccode class=\"returnvalue\"\u003ejson\u003c/code\u003e","returns":"json","text":"json ( expression [FORMAT JSON [ENCODING UTF8]] [ { WITH | WITHOUT } UNIQUE [KEYS]] ) → 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","SourceDatabase":"center","Version":"18","Locale":"en","Title":"json","Summary":"Converts a given expression specified as text or bytea string (in UTF8 encoding) into a JSON value. If expression is NULL, an SQL null value is returned. If WITH UNIQUE is specified, the expression must not contain any duplicate object keys.","BodyHTML":"Converts a given expression specified as \u003ccode\u003etext\u003c/code\u003e or \u003ccode\u003ebytea\u003c/code\u003e string (in UTF8 encoding) into a JSON value. If \u003cem\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e is NULL, an SQL null value is returned. If \u003ccode\u003eWITH UNIQUE\u003c/code\u003e is specified, the \u003cem\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e must not contain any duplicate object keys.","SourceRevision":"wiki-repair-20261023:21f6bdb05206dd9442b7eb04aec9b3cdb2154f24c08ce397dd8697c4898d410d","ContentHash":"caf88b665754f3713d1545d76c320eb38851676f3257c35c34b6d48f5e35e84e","Payload":{"description":"Converts a given expression specified as text or bytea string (in UTF8 encoding) into a JSON value. If expression is NULL, an SQL null value is returned. If WITH UNIQUE is specified, the expression must not contain any duplicate object keys.","description_html":"Converts a given expression specified as \u003ccode class=\"type\"\u003etext\u003c/code\u003e or \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e string (in UTF8 encoding) into a JSON value. If \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e is NULL, an SQL null value is returned. If \u003ccode class=\"literal\"\u003eWITH UNIQUE\u003c/code\u003e is specified, the \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e must not contain any duplicate object keys.","signatures":[{"description":"Converts a given expression specified as text or bytea string (in UTF8 encoding) into a JSON value. If expression is NULL, an SQL null value is returned. If WITH UNIQUE is specified, the expression must not contain any duplicate object keys.","description_html":"Converts a given expression specified as \u003ccode class=\"type\"\u003etext\u003c/code\u003e or \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e string (in UTF8 encoding) into a JSON value. If \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e is NULL, an SQL null value is returned. If \u003ccode class=\"literal\"\u003eWITH UNIQUE\u003c/code\u003e is specified, the \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e must not contain any duplicate object keys.","description_zh":"将给定的 text 或 bytea 字符串表达式（采用 UTF8 编码）转换为 JSON 值。如果 expression 为 NULL，则返回 SQL 空值。如果指定了 WITH UNIQUE，则 expression 不能包含重复的对象键。","description_zh_html":"将给定的 \u003ccode class=\"type\"\u003etext\u003c/code\u003e 或 \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e 字符串表达式（采用 UTF8 编码）转换为 JSON 值。如果 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e 为 NULL，则返回 SQL 空值。如果指定了 \u003ccode class=\"literal\"\u003eWITH UNIQUE\u003c/code\u003e，则 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e 不能包含重复的对象键。","examples":[{"expr":"json('{\"a\":123, \"b\":[true,\"foo\"], \"a\":\"bar\"}')","result":"{\"a\":123, \"b\":[true,\"foo\"], \"a\":\"bar\"}"}],"html":"\u003ccode class=\"function\"\u003ejson\u003c/code\u003e ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\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 { \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] ) → \u003ccode class=\"returnvalue\"\u003ejson\u003c/code\u003e","returns":"json","text":"json ( expression [FORMAT JSON [ENCODING UTF8]] [ { WITH | WITHOUT } UNIQUE [KEYS]] ) → json","zh_from":"same-version-manual"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["11","12","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":[{"Version":"18","Ordinal":0,"Hash":"9c4a32ee3d48f2f4a56e444b1918c49db967e3a5c1e36f40c690d5aae997cb5b","Text":"json ( expression [FORMAT JSON [ENCODING UTF8]] [ { WITH | WITHOUT } UNIQUE [KEYS]] ) → json","Returns":"json","Payload":{"description":"Converts a given expression specified as text or bytea string (in UTF8 encoding) into a JSON value. If expression is NULL, an SQL null value is returned. If WITH UNIQUE is specified, the expression must not contain any duplicate object keys.","description_html":"Converts a given expression specified as \u003ccode class=\"type\"\u003etext\u003c/code\u003e or \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e string (in UTF8 encoding) into a JSON value. If \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e is NULL, an SQL null value is returned. If \u003ccode class=\"literal\"\u003eWITH UNIQUE\u003c/code\u003e is specified, the \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e must not contain any duplicate object keys.","description_zh":"将给定的 text 或 bytea 字符串表达式（采用 UTF8 编码）转换为 JSON 值。如果 expression 为 NULL，则返回 SQL 空值。如果指定了 WITH UNIQUE，则 expression 不能包含重复的对象键。","description_zh_html":"将给定的 \u003ccode class=\"type\"\u003etext\u003c/code\u003e 或 \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e 字符串表达式（采用 UTF8 编码）转换为 JSON 值。如果 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e 为 NULL，则返回 SQL 空值。如果指定了 \u003ccode class=\"literal\"\u003eWITH UNIQUE\u003c/code\u003e，则 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e 不能包含重复的对象键。","examples":[{"expr":"json('{\"a\":123, \"b\":[true,\"foo\"], \"a\":\"bar\"}')","result":"{\"a\":123, \"b\":[true,\"foo\"], \"a\":\"bar\"}"}],"html":"\u003ccode class=\"function\"\u003ejson\u003c/code\u003e ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\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 { \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] ) → \u003ccode class=\"returnvalue\"\u003ejson\u003c/code\u003e","returns":"json","text":"json ( expression [FORMAT JSON [ENCODING UTF8]] [ { WITH | WITHOUT } UNIQUE [KEYS]] ) → json","zh_from":"same-version-manual"}}],"Spellings":null,"SQLState":null,"Evidence":null}
