我需要建立在以下格式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