I need to compare the field(Doc) in a single array and if their values matched I need to calculate the minimum value of another filed(Number)
Here is an example of the array:
[
{
"Doc": "test1",
"Number": 91
},
{
"Doc": "test1",
"Number": 94
},
{
"Doc": "test1",
"Number": 40
},
{
"Doc": "test2",
"Number": 82
},
{
"Doc": "test2",
"Number": 80
}
]
In the above array, if Doc is same I want to get the minimum value of the Number field. My output should be like this:
[
{
"Doc": "test1",
"Number": 40
}
{
"Doc": "test2",
"Number": 80
}
]