I have a map that produces json like this
{
"item": {
"Đã đặt cọc": 0,
"Chờ duyệt": 0,
"Mới tạo": 0,
"Đang đặt hàng": 0,
"Đang VC TQ-VN": 0,
"Đang phát hàng": 0,
"Đã nhận được hàng": 0,
"Đã hủy": 0
},
"name": "Đơn mua hộ"
}
And I want it to be split to this
{
"item": [
{
"name": "Đã đặt cọc",
"count": "0"
},
{
"name": "Chờ duyệt",
"count": "0"
},
...
],
"name": "Đơn kí gửi"
}
I tried this code, but it didn't work
...
HashMap<String, Object> itemSell = new HashMap<>();
// Order Sell
orderSell.put("name", "Đơn mua hộ");
for (Map.Entry<String, Long> pair : reportsStaticSellEcomos.entrySet()) {
itemSell.put("name", pair.getKey());
itemSell.put("count", pair.getValue());
orderSell.put("item", itemSell);
}
summary.add(orderSell);
The code above produces this
{
"item": {
"name": "Đã hủy",
"count": 0
},
"name": "Đơn mua hộ"
}
Yes, it only shows 1 item.
Please help me to get all of them, not only 1