I am getting following List[JSONObject] structure as a output of some snippet-
List(List({
"groupName": "group1",
"maxSeverity": -1,
"hostCount": 3,
"members": [
"192.168.20.11",
"192.168.20.52",
"192.168.20.53"
]
}),
List(),
List({
"groupName": "group1",
"maxSeverity": -1,
"hostCount": 2,
"members": [
"192.168.20.20",
"192.168.20.52"
]
}))
I want to merge whole output to form a list which contains - 1) group name
2) severity - which will be minimum from all list elements
3) hostcout - addition of hostcount from all list elements
4) members - similar array without duplicate values from all list elements.
So output will be somewhat like this-
List({
"groupName": "group1",
"maxSeverity": -1,
"hostCount": 5,
"members": [
"192.168.20.11",
"192.168.20.52",
"192.168.20.53",
"192.168.20.20",
"192.168.20.52"
]
})
How do I merge whole list to a single list to get above mentioned output???
groupNameand then use foldLeft for the different fields.