I'm having trouble using the in-built MySQL JSON functions to parse out a value from a JSON string nested inside a JSON string.
Here's a sample:
{
"SucceededAt": "2022-01-18T07:54:50.5548083Z",
"PerformanceDuration": "1463",
"Latency": "91",
"Result": "\"Request Body: {\\\"request\\\":[{\\\"id\\\":[{\\\"value\\\":\\\"1\\\"}],\\\"roles\\\":{\\\"receiver\\\":{\\\"id\\\":[{\\\"value\\\":\\\"1115559991\\\"}]}},\\\"details\\\":{\\\"adjustmentAmount\\\":{\\\"value\\\":7800}}}]}, Response Body:{\\\"response\\\":[{\\\"id\\\":[{\\\"value\\\":\\\"1\\\"}],\\\"parts\\\":{\\\"specification\\\":{\\\"characteristicsValue\\\":[{\\\"characteristicName\\\":\\\"MSISDN\\\",\\\"value\\\":\\\"9998885556\\\"},{\\\"characteristicName\\\":\\\"ResponseCode\\\",\\\"value\\\":\\\"1000\\\"},{\\\"characteristicName\\\":\\\"ResponseDescription\\\",\\\"value\\\":\\\"Operation successfully.\\\"}]}}}]}\""
}
I want to get the "request" and response" key/value pairs from within the "Result" key/value.
When I use SELECT JSON_VALUE(Data, '$.Result') FROM [...]
to extract the value from the "Result" key, it returns the escaped string value (which is again, json-within-json, I think) as follows (with the double-quote characters):
"Request Body: {\"request\":[{\"id\":[{\"value\":\"1\"}],\"roles\":{\"receiver\":{\"id\":[{\"value\":\"114787601\"}]}},\"details\":{\"adjustmentAmount\":{\"value\":7800}}}]}, Response Body:{\"response\":[{\"id\":[{\"value\":\"1\"}],\"parts\":{\"specification\":{\"characteristicsValue\":[{\"characteristicName\":\"MSISDN\",\"value\":\"114787601\"},{\"characteristicName\":\"ResponseCode\",\"value\":\"1000\"},{\"characteristicName\":\"ResponseDescription\",\"value\":\"Operation successfully.\"}]}}}]}"
This is the step I'm stuck at.
Is there a way to do this with the in-built MySQL JSON functions?