Given below JSON, I need to retrieve all columnList.metricColumnName for a given metricGroupName. Please help. I tried all possible JSONPath, not working.
String grp="group1";
tried this- List<Map<String, ?>> metrics =from(jsonOutput).get("metricGroupTypeList[0].columnList*.findAll {metricGroupName =='"+grp+"'}");
JSON as below:
{
"entityType": "type1",
"typeDisplayName": "Type1",
"parentTargetType": "ParentType1",
"meClass": "TARGET",
"category": "Others",
"metricGroupTypeList": [
{
"entityTypeName": "type1",
"metricGroupDisplayName": "group1",
"metricGroupName": "group1",
"config": false,
"displayInUI": true,
"parentMGName": null,
"fullPath": "group1",
"columnList": [
{
"metricColumnDisplayName": "column1",
"metricColumnName": "column1",
"metricColumnClass": "NUM",
"typeFormat": null,
},
{
"metricColumnDisplayName": "column2",
"metricColumnName": "column2",
"metricColumnClass": "NUM",
"typeFormat": null,
}
],
"description": null,
"stm": true,
"curationLevel": 1,
"extension": false,
"keyColumnNames": []
},
{
"entityTypeName": "type2",
"metricGroupDisplayName": "group2",
"metricGroupName": "group2",
"config": false,
"displayInUI": true,
"parentMGName": null,
"fullPath": "group2",
"columnList": [
{
"metricColumnDisplayName": "column1",
"metricColumnName": "column1",
"metricColumnClass": "NUM",
"typeFormat": null,
}
],
"description": null,
"stm": true,
"curationLevel": 1,
"extension": false,
"keyColumnNames": []
}
]
}