import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; try { JSONParser parser = new JSONParser(); JSONObject jsonObject = (JSONObject) parser.parse(jsonString); } catch (ParseException e) { e.printStackTrace(); } String name = (String) jsonObject.get("name"); JSONArray friendsArray = (JSONArray) jsonObject.get("friends"); for (Object friend : friendsArray) { String friendName = (String) friend; }


上一篇:
下一篇:
切换中文