我需要建立在以下格式JSON响应:有没有更好的方法来实现HashMap <String,List <HashMap <String,List <Details> >>>?
{"responseCode":"00",
"responseMessage":"Success",
"planList":[
{"category":"category1",
"details":...}
{"category":"category2",
"details":...}
{"category":"category3",
"details":...}
]}
我想出了HashMap<String, List<HashMap<String, List<Details>>>>
,但我觉得应该有一个更好的方式来做到这一点。请帮忙。
在此先感谢。
创建您自己的类并封装复杂的数据结构。有一个列表的地图列表的地图不是一个好主意。从'HashMap'开始,其中'Response'是你自己的类,它包装了有hashmap(也可以分成两个类)的列表。 –
Maroun