【发布时间】:2019-02-26 17:07:55
【问题描述】:
我有来自 arraylist 的 JSON 数据
原样:
[{"CategoryID":"2","Discontinued":"0","ProductID":"3","ProductName":"Aniseed Syrup","QuantityPerUnit":"12 - 550 ml bottles","ReorderLevel":"25","SupplierID":"1","UnitPrice":"10000","UnitsInStock":"13","UnitsOnOrder":"70"},{"CategoryID":"2","Discontinued":"1","ProductID":"5","ProductName":"Chef Anton\u0027s Gumbo Mix","QuantityPerUnit":"36 boxes","ReorderLevel":"0","SupplierID":"2","UnitPrice":"21350","UnitsInStock":"0","UnitsOnOrder":"0"},{"CategoryID":"2","Discontinued":"0","ProductID":"3","ProductName":"Aniseed Syrup","QuantityPerUnit":"12 - 550 ml bottles","ReorderLevel":"25","SupplierID":"1","UnitPrice":"10000","UnitsInStock":"13","UnitsOnOrder":"70"}]
如何在java android 中通过arraylist 的产品id & sum unitprice & quantity 合并JSON数据?
未来:
[{"CategoryID":"2","Discontinued":"0","ProductID":"3","ProductName":"Aniseed Syrup","QuantityPerUnit":"2","ReorderLevel":"25","SupplierID":"1","UnitPrice":"20000","UnitsInStock":"13","UnitsOnOrder":"70"},{"CategoryID":"2","Discontinued":"1","ProductID":"5","ProductName":"Chef Anton\u0027s Gumbo Mix","QuantityPerUnit":"36 boxes","ReorderLevel":"0","SupplierID":"2","UnitPrice":"21350","UnitsInStock":"0","UnitsOnOrder":"0"}]
【问题讨论】:
-
你有没有尝试过?你的方法是什么?进展如何?