JSON解析(给个网址求网站东西)

public class InIntent {

private static List data;
private static ByteArrayOutputStream bos;

public static List getIntent(String web,int length){
    data = new ArrayList<>();
    try {
        URL url=new URL(web);
        HttpURLConnection connection= (HttpURLConnection) url.openConnection();
        connection.setConnectTimeout(3000);
        connection.setRequestMethod("GET");
        connection.setRequestProperty("accept","*/*");
        connection.setRequestProperty("connection","Keep-Alive");
        connection.setRequestProperty("Aaccept-Charset","utf-8");
        int code = connection.getResponseCode();
        if (code==200){
            BufferedReader output=new BufferedReader(new InputStreamReader
                    (connection.getInputStream(),"UTF-8"));
            String s = output.readLine();
            JSONObject object= new JSONObject(s);
            JSONArray array=object.getJSONArray("list");
            for(int i=0;i

}

你可能感兴趣的:(JSON解析(给个网址求网站东西))