{"Entry":{"collection":"func","key":"json-to-record","name":"json_to_record","aliases":[],"metadata":{"changed_in":[],"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"}],"content_hash":"9dbb434c1cd92a6d7a3652b3f8810d0bc530fa164f85e99ff18946ffdb0283f3","first_version":"9.4","group":"json","group_label":"Json Functions And Operators","groups":["json"],"imported_at":"2026-09-14T21:49:48.794722+08:00","last_version":"20","name":"json_to_record","name_key":"json_to_record","position":16022,"present_in":["9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"signature":"json_to_record ( json ) → record","signature_count":1,"slug":"json-to-record","source_rev":"2026-09-14T13:14:25.684213+00:00@99e6866c","summary":"Expands the top-level JSON object to a row having the composite type defined by an AS clause.","summary_zh":""}},"Definition":{"Collection":"func","Key":"json-to-record","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"json-to-record","SourceRevision":"2026-09-14T13:14:25.684213+00:00@99e6866c","Facts":{"description":"Expands the top-level JSON object to a row having the composite type defined by an AS clause. (As with all functions returning record, the calling query must explicitly define the structure of the record with an AS clause.) The output record is filled from fields of the JSON object, in the same way as described above for json[b]_populate_record. Since there is no input record value, unmatched columns are always filled with nulls.","description_html":"Expands the top-level JSON object to a row having the composite type defined by an \u003ccode class=\"literal\"\u003eAS\u003c/code\u003e clause. (As with all functions returning \u003ccode class=\"type\"\u003erecord\u003c/code\u003e, the calling query must explicitly define the structure of the record with an \u003ccode class=\"literal\"\u003eAS\u003c/code\u003e clause.) The output record is filled from fields of the JSON object, in the same way as described above for \u003ccode class=\"function\"\u003ejson[b]_populate_record\u003c/code\u003e. Since there is no input record value, unmatched columns are always filled with nulls.","description_zh":"","description_zh_html":"","doc":{"anchor":"FUNCTIONS-JSON-PROCESSING-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":"Expands the top-level JSON object to a row having the composite type defined by an AS clause. (As with all functions returning record, the calling query must explicitly define the structure of the record with an AS clause.) The output record is filled from fields of the JSON object, in the same way as described above for json[b]_populate_record. Since there is no input record value, unmatched columns are always filled with nulls.","description_html":"Expands the top-level JSON object to a row having the composite type defined by an \u003ccode class=\"literal\"\u003eAS\u003c/code\u003e clause. (As with all functions returning \u003ccode class=\"type\"\u003erecord\u003c/code\u003e, the calling query must explicitly define the structure of the record with an \u003ccode class=\"literal\"\u003eAS\u003c/code\u003e clause.) The output record is filled from fields of the JSON object, in the same way as described above for \u003ccode class=\"function\"\u003ejson[b]_populate_record\u003c/code\u003e. Since there is no input record value, unmatched columns are always filled with nulls.","description_zh":"","description_zh_html":"","examples":[{"expr":"select * from json_to_record('{\"a\":1,\"b\":[1,2,3],\"c\":[1,2,3],\"e\":\"bar\",\"r\": {\"a\": 123, \"b\": \"a b c\"}}') as x(a int, b text, c int[], d text, r myrowtype)","result":" a |    b    |    c    | d |       r\n---+---------+---------+---+---------------\n 1 | [1,2,3] | {1,2,3} |   | (123,\"a b c\")"}],"html":"\u003ccode class=\"function\"\u003ejson_to_record\u003c/code\u003e ( \u003ccode class=\"type\"\u003ejson\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003erecord\u003c/code\u003e","returns":"record","text":"json_to_record ( json ) → record","zh_from":""}],"zh_from":""},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-JSON-PROCESSING-TABLE","file":"functions-json.html","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"json-to-record","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"json_to_record","Summary":"将顶级JSON对象展开为具有由 AS子句定义的复合类型的行。（与所有返回record的函数一样，调用查询必须使用AS子句显式定义记录的结构。）输出记录由JSON对象的字段填充，与上面描述的json[b]_populate_record的方式相同。由于没有输入记录值，不匹配的列总是用空值填充。","BodyHTML":"将顶级JSON对象展开为具有由 \u003ccode\u003eAS\u003c/code\u003e子句定义的复合类型的行。（与所有返回\u003ccode\u003erecord\u003c/code\u003e的函数一样，调用查询必须使用\u003ccode\u003eAS\u003c/code\u003e子句显式定义记录的结构。）输出记录由JSON对象的字段填充，与上面描述的\u003ccode\u003ejson[b]_populate_record\u003c/code\u003e的方式相同。由于没有输入记录值，不匹配的列总是用空值填充。\u003cpre\u003ejson_to_record ( json ) → record\u003c/pre\u003e将顶级JSON对象展开为具有由 \u003ccode\u003eAS\u003c/code\u003e子句定义的复合类型的行。（与所有返回\u003ccode\u003erecord\u003c/code\u003e的函数一样，调用查询必须使用\u003ccode\u003eAS\u003c/code\u003e子句显式定义记录的结构。）输出记录由JSON对象的字段填充，与上面描述的\u003ccode\u003ejson[b]_populate_record\u003c/code\u003e的方式相同。由于没有输入记录值，不匹配的列总是用空值填充。","SourceRevision":"ca936764","ContentHash":"58407c609c69044f8a0b10f732c800905cceca6e4860844d360052c39de1d8a6","Payload":{"description_zh":"将顶级JSON对象展开为具有由 AS子句定义的复合类型的行。（与所有返回record的函数一样，调用查询必须使用AS子句显式定义记录的结构。）输出记录由JSON对象的字段填充，与上面描述的json[b]_populate_record的方式相同。由于没有输入记录值，不匹配的列总是用空值填充。","description_zh_html":"将顶级JSON对象展开为具有由 \u003ccode class=\"literal\"\u003eAS\u003c/code\u003e子句定义的复合类型的行。（与所有返回\u003ccode class=\"type\"\u003erecord\u003c/code\u003e的函数一样，调用查询必须使用\u003ccode class=\"literal\"\u003eAS\u003c/code\u003e子句显式定义记录的结构。）输出记录由JSON对象的字段填充，与上面描述的\u003ccode class=\"function\"\u003ejson[b]_populate_record\u003c/code\u003e的方式相同。由于没有输入记录值，不匹配的列总是用空值填充。","signatures":[{"description_zh":"将顶级JSON对象展开为具有由 AS子句定义的复合类型的行。（与所有返回record的函数一样，调用查询必须使用AS子句显式定义记录的结构。）输出记录由JSON对象的字段填充，与上面描述的json[b]_populate_record的方式相同。由于没有输入记录值，不匹配的列总是用空值填充。","description_zh_html":"将顶级JSON对象展开为具有由 \u003ccode class=\"literal\"\u003eAS\u003c/code\u003e子句定义的复合类型的行。（与所有返回\u003ccode class=\"type\"\u003erecord\u003c/code\u003e的函数一样，调用查询必须使用\u003ccode class=\"literal\"\u003eAS\u003c/code\u003e子句显式定义记录的结构。）输出记录由JSON对象的字段填充，与上面描述的\u003ccode class=\"function\"\u003ejson[b]_populate_record\u003c/code\u003e的方式相同。由于没有输入记录值，不匹配的列总是用空值填充。","returns":"record","text":"json_to_record ( json ) → record","zh_from":"doc"}],"zh_from":"doc"}},"RequestedLocale":"zh-Hans","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":"a98e5e76ef23d6e0d5336b13aa95ddc01ef75ffd71e9976616e702d924f1c86e","Text":"json_to_record ( json ) → record","Returns":"record","Payload":{"description":"Expands the top-level JSON object to a row having the composite type defined by an AS clause. (As with all functions returning record, the calling query must explicitly define the structure of the record with an AS clause.) The output record is filled from fields of the JSON object, in the same way as described above for json[b]_populate_record. Since there is no input record value, unmatched columns are always filled with nulls.","description_html":"Expands the top-level JSON object to a row having the composite type defined by an \u003ccode class=\"literal\"\u003eAS\u003c/code\u003e clause. (As with all functions returning \u003ccode class=\"type\"\u003erecord\u003c/code\u003e, the calling query must explicitly define the structure of the record with an \u003ccode class=\"literal\"\u003eAS\u003c/code\u003e clause.) The output record is filled from fields of the JSON object, in the same way as described above for \u003ccode class=\"function\"\u003ejson[b]_populate_record\u003c/code\u003e. Since there is no input record value, unmatched columns are always filled with nulls.","description_zh":"","description_zh_html":"","examples":[{"expr":"select * from json_to_record('{\"a\":1,\"b\":[1,2,3],\"c\":[1,2,3],\"e\":\"bar\",\"r\": {\"a\": 123, \"b\": \"a b c\"}}') as x(a int, b text, c int[], d text, r myrowtype)","result":" a |    b    |    c    | d |       r\n---+---------+---------+---+---------------\n 1 | [1,2,3] | {1,2,3} |   | (123,\"a b c\")"}],"html":"\u003ccode class=\"function\"\u003ejson_to_record\u003c/code\u003e ( \u003ccode class=\"type\"\u003ejson\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003erecord\u003c/code\u003e","returns":"record","text":"json_to_record ( json ) → record","zh_from":""}}],"Spellings":null,"SQLState":null,"Evidence":null}
