I have an array of objects like this-
{"zone":"lobby a","time":"00:00","hub":"I","Sum":0.0,"schedule":"2022"},
{"zone":"lobby b","time":"00:01","hub":"I","Sum":1.0,"schedule":"112022"},
{"zone":"lobby a","time":"00:01","hub":"I","Sum":2.0,"schedule":"11_2022"},
{"zone":"lobby b","time":"00:03","hub":"I","Sum":0.0,"schedule":"11_2022"},
{"zone":"lobby c","time":"00:04","hub":"I","Sum":1.0,"schedule":"11_2022"},
{"zone":"lobby c","time":"00:04","hub":"I","Sum":2.0,"schedule":"11_2022"},
The duplicate 'time' needs to be merged by adding the sums only if the zone is same.
Result should be
{"zone":"lobby a","time":"00:00","hub":"I","Sum":0.0,"schedule":"2022"},
{"zone":"lobby b","time":"00:01","hub":"I","Sum":1.0,"schedule":"112022"},
{"zone":"lobby a","time":"00:01","hub":"I","Sum":2.0,"schedule":"11_2022"},
{"zone":"lobby b","time":"00:03","hub":"I","Sum":0.0,"schedule":"11_2022"},
{"zone":"lobby c","time":"00:04","hub":"I","Sum":3.0,"schedule":"11_2022"},
Any help will be much appreciated. I have tried many options using maps etc, but have not been successful.