Here is a sample document
{
“vendoraccommodationroomkey”: “76FD9D6E-90D1-E911-80F0-005056B91133”,
“resortgroupid”: 14247,
“supplierid”: 12,
“roomname”: “Pool View: King room”,
“isnonrefundable”: 0,
“isbreakfastincluded”: 0,
“accommodation_category”: “standard”,
“accommodation_type”: “room”,
“bed_types”: [
{
“king”: 1
}
],
“number_of_bedrooms”: null,
“view”: true,
“orientation”: {
“view”: [
“pool”
]
}
}
I’d like to create a string out of this data by combining some of the elements (columns?). For example, I’d want to create an output that looks like the below using concatenation features in the select:
standard room 1 king bed pool view
I’m stuck on the bed part, as the name of the bed is also the actual object name. Is it possible, knowing that that attribute could change, that i am able to select it no matter what is there? I’ve gotten this far, but I can’t seem to isolate the attribute in a way that allows me to concatenate it in the select
select r.accommodation_category||’ '||r.accommodation_type, x.*
from roomstest r
unnest bed_types as x