JAVA中如何将一个json形式的字符串转为json对象
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 } }