My table looks like this:
id | data |
---|---|
1 | {tags: {"env": "dev", "owner": "me"}} |
I want to fetch the data and inside the select query convert the data column to the following format:
id | data |
---|---|
1 | {tags: [{"key": "env", "value": "dev"}, {"key": "owner", "value": "me"}]} |
I've tried several JSON mysql functions but the closest I got is :
id | data |
---|---|
1 | {tags: [{"key": "env", "value": ["dev", "me"]}, {"key": "owner", "value": ["dev", "me"]}]} |
Any suggestions?
Thanks