For the below JSON
{
"employee": {
"insurances": {
"insurance1": "45.1",
"insurance2": "505.5"
}
},
"id":61
}
Im using below code snippet to retrieve values from each field
Map<String, Object> insuranceDetails = (Map) ((Map) sourceAsMap.get("employee"))
.get("insurances");
insuranceDetails.get("insurance1");
insuranceDetails.get("insurance2");
Would like to know is there any better/efficient way to achieve this? It has to run inside the loop so Im worrying about the performance. "insurance1" and "insurance2" are fixed fields.