调用 api 时只得到一半的 json 日期
Only get half of json date when call api
我的响应码是200,我获取数据成功了,但是我发现我的json数据不完整。我真的不知道为什么,我的代码有问题吗?
这是我的获取数据函数:
private String getRouteJson(String url) throws IOException {
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
connection.setRequestProperty("Accept", "application/json");
connection.setRequestMethod("GET");
int responseCode = connection.getResponseCode();
Log.d(TAG, "responseCode:"+responseCode );
StringBuilder jsonIn = new StringBuilder();
if (responseCode == 200) {
BufferedReader bf = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
while ((line = bf.readLine()) != null) {
jsonIn.append(line);
}
} else {
Log.d(TAG, "responseCode:"+responseCode );
}
connection.disconnect();
Log.d(TAG, "jsonIn:" + jsonIn.toString());
return jsonIn.toString();
}
我得到了去 ,"EDUFDATE":"2017/09/07","SPONSER":"Asian EUS Group","EDUTYPE":"Dom
时卡住的数据
这是我的 api:
http://114.35.246.42:2212/MobileApp/DEST_WebService.asmx/GetEduData
我以前没有遇到过这个问题,我真的不知道如何修复它。
有谁能帮我解决这个问题吗?那将不胜感激!
它获取数据 util "Dom 并停止...
您正在 logcat 中记录大量数据。 Logcat不会完全显示。但是完整的数据存在于 jsonIn 字符串中。您可以继续处理输出
正如@shayan 评论的那样,如果您希望logcat 显示完整的数据
,您可以检查此link
您想查看完整的回复 ??
勾选跟随方式。
在您获得响应的地方添加断点。
在 DebugConsole 中有一个选项 view Check Image
它将显示您的完整回复
我的响应码是200,我获取数据成功了,但是我发现我的json数据不完整。我真的不知道为什么,我的代码有问题吗?
这是我的获取数据函数:
private String getRouteJson(String url) throws IOException {
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
connection.setRequestProperty("Accept", "application/json");
connection.setRequestMethod("GET");
int responseCode = connection.getResponseCode();
Log.d(TAG, "responseCode:"+responseCode );
StringBuilder jsonIn = new StringBuilder();
if (responseCode == 200) {
BufferedReader bf = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
while ((line = bf.readLine()) != null) {
jsonIn.append(line);
}
} else {
Log.d(TAG, "responseCode:"+responseCode );
}
connection.disconnect();
Log.d(TAG, "jsonIn:" + jsonIn.toString());
return jsonIn.toString();
}
我得到了去 ,"EDUFDATE":"2017/09/07","SPONSER":"Asian EUS Group","EDUTYPE":"Dom
这是我的 api: http://114.35.246.42:2212/MobileApp/DEST_WebService.asmx/GetEduData
我以前没有遇到过这个问题,我真的不知道如何修复它。
有谁能帮我解决这个问题吗?那将不胜感激!
它获取数据 util "Dom 并停止...
您正在 logcat 中记录大量数据。 Logcat不会完全显示。但是完整的数据存在于 jsonIn 字符串中。您可以继续处理输出
正如@shayan 评论的那样,如果您希望logcat 显示完整的数据
,您可以检查此link您想查看完整的回复 ??
勾选跟随方式。
在您获得响应的地方添加断点。
在 DebugConsole 中有一个选项 view Check Image
它将显示您的完整回复