Here' a dummy data for the jsonb column
{
"address": [
{
"country": "US",
"extension": [
{
"extension": [
{
"valueDecimal": -71.024638,
"url": "latitude"
},
{
"url": "longitude",
"valueDecimal": 42.082543
}
],
"url": "url1"
}
],
"postalCode": "02301",
"city": "Brockton"
},
{
"country": "US",
"extension": [
{
"extension": [
{
"valueDecimal": -71.024638,
"url": "latitude"
},
{
"url": "longitude",
"valueDecimal": 42.082543
}
],
"url": "url2"
}
],
"postalCode": "02301",
"city": "Brockton"
}
]
}
I want to get something like, address->'extension'->'extension'->'valueDecimal' but it only works with the json but it is an array of JSON data...my expecting output -
[-71.024638, -71.024638]
I'm able to get a first extension(i.e first array of JSON ) with the below query
SELECT elems.value FROM "patient", jsonb_array_elements(resource -> 'extension') AS elems;
so the problem is that I'm not able to get inner 'extension'(It is inside the extension object) data. Any help will be Helpful.