{"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","derived_content_hash":"db88643db6676910a314f910bb9783666f6f9946eba2d483e19750dde4b08646","documentation_refresh":{"batch":"20261113","original_source_rev":"wiki-repair-20261023:833d6717ca264b4469d66853e9a26fef0aa4505b5d2f183222bcfd4f0e2011f6","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.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"],"repair_provenance":{"original_source_revision":"2026-09-14T13:14:25.684213+00:00@99e6866c","receipt_sha256":"bae46987bd68c1613136eaed0735e1b1c0bd83ac58351825c8d152f19a434414","repair":"wiki-repair-20261023"},"signature":"json_to_record ( json ) → record","signature_count":1,"slug":"json-to-record","source_rev":"wiki-repair-20261023:833d6717ca264b4469d66853e9a26fef0aa4505b5d2f183222bcfd4f0e2011f6","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":"wiki-repair-20261023:833d6717ca264b4469d66853e9a26fef0aa4505b5d2f183222bcfd4f0e2011f6","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":"将顶级 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 的方式相同。由于没有输入记录值，不匹配的列总是用空值填充。","doc":{"anchor":"FUNCTIONS-JSON-PROCESSING-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":"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":"将顶级 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 的方式相同。由于没有输入记录值，不匹配的列总是用空值填充。","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":"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-PROCESSING-TABLE","file":"functions-json.html","sha256":"060b67147827d70ddcf5948833ddfbeada321366476016c8b8b7d68afda8045c","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"json-to-record","SourceDatabase":"center","Version":"18","Locale":"en","Title":"json_to_record","Summary":"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.","BodyHTML":"Expands the top-level JSON object to a row having the composite type defined by an \u003ccode\u003eAS\u003c/code\u003e clause. (As with all functions returning \u003ccode\u003erecord\u003c/code\u003e, the calling query must explicitly define the structure of the record with an \u003ccode\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\u003ejson[b]_populate_record\u003c/code\u003e. Since there is no input record value, unmatched columns are always filled with nulls.","SourceRevision":"wiki-repair-20261023:833d6717ca264b4469d66853e9a26fef0aa4505b5d2f183222bcfd4f0e2011f6","ContentHash":"d01413eebb6f4cb45c31f2fc09f9be1eaff225e63b09a092402893bac55894d1","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.","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":"将顶级 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 的方式相同。由于没有输入记录值，不匹配的列总是用空值填充。","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":"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":"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":"将顶级 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 的方式相同。由于没有输入记录值，不匹配的列总是用空值填充。","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":"same-version-manual"}}],"Spellings":null,"SQLState":null,"Evidence":null}
