import java.io.*; import org.json.*; public class Demo { public static void main(String[] args) throws Exception { String str = "{\"a\":\"b\", \"c\":\"d\"}"; JSONObject a = new JSONObject(str); System.out.println(a); // {"c":"d","a":"b"} System.out.println(a.get("c")); // d } }
时间: 2024-10-12 22:43:13