解析没有key的Json

 

没有key的Json,例如:["http://www.cnblogs.com/Cherry-B/p/4625133.html","http://www.cnblogs.com/Cherry-B/p/4619689.html","http://www.cnblogs.com/Cherry-B/p/4613701.html"]

  public void alyJson(String urls) {

    ArrayList<String> urlList = null;

    if (urls != null) {

      try {

        JSONArray array = new JSONArray(urls);

        urlList = new ArrayList<String>();

        for (int i = 0; i < array.length(); i++) {

          String s = array.getString(i);

          urlList.add(s);

        }

      } catch (JSONException e) {

        e.printStackTrace();

      }

    }



    if (urlList != null) {

      for (String url : urlList) {

        webView.loadUrl(url);

      }

    }

  }

 

你可能感兴趣的:(json)