json字符串转java map
形如这样的var json={ "people": [ { "firstName": "Brett", "lastName":"McLaughlin", "email": "brett@newInstance.com" }, { "firstName": "Jason", "lastName":"Hunter", "email": "jason@servlets.com" }, { "firstName": "Elliotte", "lastN1ame":"Harold", "email": "elharo@macfaq.com" } ]};,传递到后台怎么转化成map或list啊
满意回答
2011-12-13 10:26热心网友
for (int i = 0; i < ja.size(); i++) { JSONObject jasonObject = JSONObject.fromObject(ja.get(i)); Map<String, Object> map2 = (Map) jasonObject; System.out.print(map2.get("name") + ","); System.out.println(map2.get("id")); }
赞同1
|
评论