拼接 string 翻译成 jsonarray形式

/*翻译string 到 json

*  String jsonMessage = "[{'num':'成绩', '外语':88, '历史':65, '地理':99, 'object':{'aaa':'1111','bbb':'2222','cccc':'3333'}}," +

          "{'num':'兴趣', '外语':28, '历史':45, '地理':19, 'object':{'aaa':'11a11','bbb':'2222','cccc':'3333'}}," +

          "{'num':'爱好', '外语':48, '历史':62, '地理':39, 'object':{'aaa':'11c11','bbb':'2222','cccc':'3333'}}]";

 

try{

JSONArray array = JSONArray.fromObject(jsonMessage);

for (int i = 0; i < array.size(); i++) {

JSONObject iObj = array.getJSONObject(i);

System.out.println(iObj.get("num"));

}

}catch(Exception e){

 

}*/

你可能感兴趣的:(JsonArray)