String json = "{\"name\": \"John\", \"age\": 30, \"city\": \"New York\"}"; JSONObject jsonObject = new JSONObject(json); String name = jsonObject.getString("name"); int age = jsonObject.getInt("age"); String city = jsonObject.getString("city"); JSONObject jsonObject = new JSONObject(); jsonObject.put("name", "John"); jsonObject.put("age", 30); jsonObject.put("city", "New York"); String json = jsonObject.toString();


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