Expands the top-level JSON array of objects to a set of rows having the composite type defined by an AS clause.
Signatures & examples
json_to_recordset ( json ) → setof record
Expands the top-level JSON array of objects to a set of rows 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.) Each element of the JSON array is processed as described above for json[b]_populate_record.
select * from json_to_recordset('[{"a":1,"b":"foo"}, {"a":"2","c":"bar"}]') as x(a int, b text) → a | b
---+-----
1 | foo
2 |