【发布时间】:2015-04-16 16:31:16
【问题描述】:
我正在尝试将 Json 与 android 一起使用 我有一个返回 Json 字符串的链接
InputStream is = new URL(url).openStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
String jsonText = readAll(rd);
JSONObject json = new JSONObject(jsonText);
但是,在制作一个新的 JSONObject(jsonText);它压碎了。
这是我的网址:http://igorsdomain.byethost3.com/getUser.php?username=SailorBoogy&password=qwerty&event=2222
这是返回的对象:{"ID":"23","Username":"SailorBoogy","Password":"qwerty","eventID":"6"}
我也试过JSONObject(jsonText.replaceAll("\"" , "\\\\\""));
但它没有用。
有什么问题?我用错了吗?
Json 库:
org.json.JSONException; org.json.JSONObject; org.json.JSONStringer;
【问题讨论】:
-
您使用的是哪个 JSON 库? Java、Jackson 等中的 JSON?
标签: android json jsonobject