通过url获取到json数据
public static String getURLContent(String url) {
StringBuilder result = new StringBuilder();
try {
URL urlObject = new URL(url);
URLConnection uc = urlObject.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(uc.getInputStream(),"gbk"));
String inputLine = null;
while ( (inputLine = in.readLine()) != null) {
result.append(inputLine+"||");
}
in.close();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return result.toString();
}