import org.json.JSONException;
import org.json.JSONObject;
public class JsonParse {
public static void main(String[] args) {
JSONObject jsonObject = null;
try {
jsonObject = new JSONObject("{\"name\" : \"zhangsan\", \"age\" : 18, \"married\" : \"true\"}");
} catch (JSONException e) {
e.printStackTrace();
}
String name = jsonObject.optString("name");
System.out.println(name);
}
}
报错,初学,什么也不懂,请指教,感谢