If the code AND land are the same then add this json part to final_array.
Next if the next json part has the same code and land, then add size and value to the previous
one,while every other part of the json stays the same.
If code AND land are NOT the same then skip and add as a new json part to final_array.
[
{
"size": 1,
"code": "300",
"content": "xyz",
"land": "AB",
"value": 5
},
{
"size": 1,
"code": "300",
"content": "xyz",
"land": "AB",
"value": 10
},
{
"size": 1,
"code": "400",
"content": "abc",
"land": "KK",
"value": 12
}
]
End Result should look like this:{
"code": "300",
"content": "xyz",
"land": "AB",
"size": 2,
"value": 15
},
{
"code": "400",
"content": "abc",
"land": "KK",
"size": 1,
"value": 12
}
]

Report
All responses (
Answers (