Answer the question
In order to leave comments, you need to log in
What manipulations to carry out over a collection to receive result of desirable structure?
Hello.
I have a collection of this kind (simplified for simplicity)
{
"1": [
{
"id": "1",
"qty": "4",
"subtotal": "2400.00"
},
{
"id": "2",
"qty": "2",
"subtotal": "4000.00"
}
],
"2": [
{
"id": "3",
"qty": "2",
"subtotal": "3000.00"
}
]
}
{
"1": {
"qty": "6",
"subtotal": "6400.00"
},
"2": {
"qty": "2",
"subtotal": "3000.00"
}
}
Answer the question
In order to leave comments, you need to log in
You need to use exactly two methods - mapWithKeys and sum (having previously wrapped the internal arrays in a collection).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question