Hey there, I'm just starting to work with JSON and TypeScript. I have a JSON object that needs processing, where each child value must be added up to set the parent values as the sum of corresponding attributes from its children.
"parentValues":[{
"number1": 0,
"number2": 0,
"parentId": 1,
"childValues": [{
"number1": 10,
"number2": 20,
"childId": 1
},
{
"number1": 30,
"number2": 40,
"childId": 2
}
]}]
After processing, it should look like this :
"parentValues":[{
"number1": 10+30,
"number2": 20+40,
"parentId": 1,
"childValues": [{
"number1": 10,
"number2": 20,
"childId": 1
},
{
"number1": 30,
"number2": 40,
"childId": 2
}
]}]