SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
create table tbl ( fld json ); insert into tbl values ('{ "id": "adf59079-4921-4abc-a262-1dc8c2b1ccc7", "lastname": "LOBATOS", "firstname": "Leslie", "birth_date": "1988-01-26", "gender": 3, "contacts": { "phoneList": [ { "fullNumber": "0671234567", "verifyStateId": 1 }, { "fullNumber": "0671234588", "verifyStateId": 0 } ] } }'::json); -- id, lastname, fullNumber with unnested as ( select fld->>'id' id, fld->>'lastname' lastname, json_array_elements(((fld->>'contacts')::json->>'phoneList')::json) from tbl ) select * from unnested;
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear