I have a TEXT variable in MySQL 5.7 that stores a JSON. Within this JSON there is a list with the following structure of N elements:
"brandedFares": [
{
"type": "name1",
"status": "allow"
},
{
"type": "name2",
"status": "not allowed"
},
...
The problem is that these elements may come in different order and some of those may be missing. I am building a summary table that can show if any of these elements come and their status.
name1_exists | name1_status | name2_exists | name2_status |
---|---|---|---|
TRUE | allow | TRUE | not allowed |
I tried to work it out with JSON_EXTRACT and substring_index but the fact that the list does not have an order kind of throws me out. Do you have any ideas or advices of how to do this within MySQL?