JSON转String转JSONArray-猿气满满-CSDN博客「建议收藏」

发布时间:2025-12-09 14:15:46 浏览次数:7

String转JSON

String jsonStr= "{status:200,massage:0,result:{id:0987,name:"csdn"}}";//转jsonJSONObject json = JSONObject.fromObject(jsonStr);

JSON转JSONArray

JSONObject json = JSONObject.fromObject("{status:200,massage:0}");JSONArray array = JSONArray.fromObject(json);

JSONArray转JSON

JSONArray array = JSONArray.fromObject("[{\"id\":\"0987\",\"name\":\"csdn\"},{\"id\":\"0987\",\"name\":\"csdn\"}]");JSONObject json = array.get(0);
需要做网站?需要网络推广?欢迎咨询客户经理 13272073477