我已经能够从 json 字符串中获取 jsonarray,但不知道如何将它放入 Hashmap 中,其中包含显示货物类型的字符串和显示数量的整数。
字符串:
"cargo":[
{"type":"Coals","amount":75309},
{"type":"Chemicals","amount":54454},
{"type":"Food","amount":31659},
{"type":"Oil","amount":18378}
]
原文由 Zoef 发布,翻译遵循 CC BY-SA 4.0 许可协议
这为我修好了: