MyTable.MyField in my PostgreSQL database contains the following (simplified) JSON block:
{
"base": {
"fields": [
{
"fieldid": "c12f",
"fieldname": "sizes",
"choices": [
{
"choiceid": "2db3",
"size": "small"
},
{
"choiceid": "241f",
"size": "medium"
},
{
"choiceid": "3f52",
"size": "large"
}
],
"answer": "241f"
}
]
}
}
How can I use the value of answer to extract the chosen size from the choices array please (i.e. in this case "medium")?
(Note: I have tried. For a TLDR version of this question see Trying to construct PostgreSQL Query to extract from JSON a text value in an object, in an array, in an object, in an array, in an object .)
Thank you.