I am trying to filter a particular value coming from a JSON array. My sample array is given below:
"source":[
{
"value": {
"Type": [
{
"val": "Primary",
"code": "PRI"
}
],
"Value": [
{
"val": "PHAR",
"Code": "Pharmacy"
}
]
}
},
{
"value": {
"Type": [
{
"val": "Secondary",
"code": "SEC"
}
],
"Value": [
{
"val": "HOSP",
"Code": "Hospital"
}
]
}
}
]
In the above, I need to read the first occurrence of source.value.Value.val where source.value.Type.code=="SEC" My array can have multiple codes like "PRI", "SEC" etc and I need to get the data for code = "SEC" only (first occurance)