import com.minijson.JSON; import com.minijson.JSONException; public class JsonExample { public static void main(String[] args) { String jsonStr = "{\"name\":\"John\", \"age\":30, \"city\":\"New York\"}"; try { JSON json = JSON.parse(jsonStr); String name = json.getString("name"); int age = json.getInt("age"); String city = json.getString("city"); System.out.println("Name: " + name); System.out.println("Age: " + age); System.out.println("City: " + city); } catch (JSONException e) { e.printStackTrace(); } } }


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