{"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","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"],"signature":"json ( expression [ FORMAT JSON [ ENCODING UTF8 ]] [ { WITH | WITHOUT } UNIQUE [ KEYS ]] ) → json","signature_count":1,"slug":"json","source_rev":"2026-09-14T13:14:25.684213+00:00@99e6866c","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":"2026-09-14T13:14:25.684213+00:00@99e6866c","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":"","description_zh_html":"","doc":{"anchor":"FUNCTIONS-JSON-CREATION-TABLE","file":"functions-json.html","slug":"18"},"group":"json","group_label":"Json Functions And Operators","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":"","description_zh_html":"","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":""}],"zh_from":""},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-JSON-CREATION-TABLE","file":"functions-json.html","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"json","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"json","Summary":"将给定的text或bytea字符串表达式（采用 UTF8 编码）转换为 JSON 值。如果expression为 NULL，则返回SQL空值。如果指定了WITH UNIQUE，则expression不能包含重复的对象键。","BodyHTML":"将给定的\u003ccode\u003etext\u003c/code\u003e或\u003ccode\u003ebytea\u003c/code\u003e字符串表达式（采用 UTF8 编码）转换为 JSON 值。如果\u003cem\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e为 NULL，则返回SQL空值。如果指定了\u003ccode\u003eWITH UNIQUE\u003c/code\u003e，则\u003cem\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e不能包含重复的对象键。\u003cpre\u003ejson ( expression [ FORMAT JSON [ ENCODING UTF8 ]] [ { WITH | WITHOUT } UNIQUE [ KEYS ]] ) → json\u003c/pre\u003e将给定的\u003ccode\u003etext\u003c/code\u003e或\u003ccode\u003ebytea\u003c/code\u003e字符串表达式（采用 UTF8 编码）转换为 JSON 值。如果\u003cem\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e为 NULL，则返回SQL空值。如果指定了\u003ccode\u003eWITH UNIQUE\u003c/code\u003e，则\u003cem\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e不能包含重复的对象键。","SourceRevision":"1b5ca64c","ContentHash":"9c170b9cb8cb9dcc98ce711e73ac795d1703a0ab83c04fba32f52c2142e5ab24","Payload":{"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不能包含重复的对象键。","signatures":[{"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不能包含重复的对象键。","returns":"json","text":"json ( expression [ FORMAT JSON [ ENCODING UTF8 ]] [ { WITH | WITHOUT } UNIQUE [ KEYS ]] ) → json","zh_from":"doc"}],"zh_from":"doc"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["11","12","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":[{"Version":"18","Ordinal":0,"Hash":"01b6978e3726c3500062a4b6ab3bc87da5175950e647d27490085a61f146fd1e","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":"","description_zh_html":"","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":""}}],"Spellings":null,"SQLState":null,"Evidence":null}
