I receive data from an api. The data looks like this:
'displayValues': {
'mobDeviceTypeId': {
'0': 'Unknown',
'2': 'Smart Phone',
'4': 'Tablet',
'-1': 'Name is not available (-1)',
'-7': 'NA'
}
}
I´d like to store the key-value pairs for the "mobDeviceTypeId" in a table with two columns (id, device) using SQL. My problem, in comparison to other JSON objects, is that the keys differ. So, for example:
SELECT $1:"adSizeId":"10"
FROM <table>
won´t help me. As I use snowflake, I also tried it with the flatten function, but I did not get the expected result.
I would be very grateful for tips and possible solutions!
Thank you!