I've seen this same question answered in the forum but after hours of trying I'm still not getting it right. I have a nested Json that I need to extract some data from. The Json looks like this:
{
"objects": [
{
"name": "numero_movil",
"objectType": "field",
"value": "Tu número móvil:615647486",
"pageIndex": 0,
"rectangle": [0, 0, 0, 0]
},
{
"name": "codigo_pin",
"objectType": "field",
"value": "Tu código PIN: 6342",
"pageIndex": 0,
"rectangle": [0, 0, 0, 0]
},
{
"name": "codigo_puk",
"objectType": "field",
"value": "Tu código PUK: 78087660",
"pageIndex": 0,
"rectangle": [0, 0, 0, 0]
}
],
"elapsed": 0.0146939,
"templateName": "esim_details",
"templateVersion": "4",
"timestamp": "2024-05-16T23:03:26"
}
I would like to do a get("") to obtain the values of numero_movil, codigo_pin and codigo_puk. But if I use toMap() it gives me an error saying it has an invalid json format. I don't know how to break it up or turn it into something ZC will deem valid json. What should I do?
I thought of a workaround using a string search and regex. Doesn't seem as elegant but will be my plan B if I can't find a way to do this.