I have the following schema in redshift (an id column and a json dictionary as a string)
id data
1 {'1': 'true', '2':'false'}
2 {'1': 'false', '3':'true'}
and I would like to transform it to:
id key value
1 '1' 'true'
1 '2' 'false'
2 '1' 'false'
2 '3' 'true'
What would be an appropriate postgresql query for this? I have tried using JSON_EXTRACT_PATH_TEXT but then I need to union together all the individual keys and I am dealing with hundreds of keys.