Package org.json

Examples of org.json.JSONArray.optJSONObject()


        final JSONArray array = result.optJSONArray(Keys.RESULTS);
        if (0 == array.length()) {
            return null;
        }
       
        return array.optJSONObject(0);
    }

    /**
     * Gets the {@link ArticleCommentGAERepository} singleton.
     *
 
View Full Code Here


        if (0 == array.length()) {
            return null;
        }

        return array.optJSONObject(0).optString(Article.ARTICLE + "_"
                                                + Keys.OBJECT_ID);
    }

    @Override
    public JSONObject getSoloArticle(final String externalArticleId,
View Full Code Here

        JSONArray jsonArrForecast = (jsonObj != null) ? jsonObj.optJSONArray(this.JSON_FORECAST_LIST) : null;
        this.forecastList = (jsonArrForecast != null) ? new ArrayList<Forecast>(jsonArrForecast.length()) : Collections.EMPTY_LIST;
        if (this.forecastList != Collections.EMPTY_LIST) {
            for (int i = 0; i < jsonArrForecast.length(); i++) {
                JSONObject jsonObjWeather = jsonArrForecast.optJSONObject(i);
                if (jsonObjWeather != null) {
                    this.forecastList.add(new Forecast(jsonObjWeather));
                }
            }
        }
View Full Code Here

            JSONArray jsonArrWeather = (jsonObj != null) ? jsonObj.optJSONArray(this.JSON_WEATHER) : null;
            this.weatherList = (jsonArrWeather != null) ? new ArrayList<Weather>(jsonArrWeather.length()) : Collections.EMPTY_LIST;
            if (this.weatherList != Collections.EMPTY_LIST) {
                for (int i = 0; i < jsonArrWeather.length(); i++) {
                    JSONObject jsonObjWeather = jsonArrWeather.optJSONObject(i);
                    if (jsonObjWeather != null) {
                        this.weatherList.add(new Weather(jsonObjWeather));
                    }
                }
            }
View Full Code Here

        JSONArray jsonArrWeather = (jsonObj != null) ? jsonObj.optJSONArray(this.JSON_WEATHER) : null;
        this.weatherList = (jsonArrWeather != null) ? new ArrayList<Weather>(jsonArrWeather.length()) : Collections.EMPTY_LIST;
        if (this.weatherList != Collections.EMPTY_LIST) {
            for (int i = 0; i < jsonArrWeather.length(); i++) {
                JSONObject jsonObjWeather = jsonArrWeather.optJSONObject(i);
                if (jsonObjWeather != null) {
                    this.weatherList.add(new Weather(jsonObjWeather));
                }
            }
        }
View Full Code Here

        JSONArray jsonArrForecast = (jsonObj != null) ? jsonObj.optJSONArray(this.JSON_FORECAST_LIST) : null;
        this.forecastList = (jsonArrForecast != null) ? new ArrayList<Forecast>(jsonArrForecast.length()) : Collections.EMPTY_LIST;
        if (this.forecastList != Collections.EMPTY_LIST) {
            for (int i = 0; i < jsonArrForecast.length(); i++) {
                JSONObject jsonObjWeather = jsonArrForecast.optJSONObject(i);
                if (jsonObjWeather != null) {
                    this.forecastList.add(new Forecast(jsonObjWeather));
                }
            }
        }
View Full Code Here

            JSONArray jsonArrWeather = (jsonObj != null) ? jsonObj.optJSONArray(this.JSON_WEATHER) : null;
            this.weatherList = (jsonArrWeather != null) ? new ArrayList<Weather>(jsonArrWeather.length()) : Collections.EMPTY_LIST;
            if (this.weatherList != Collections.EMPTY_LIST) {
                for (int i = 0; i < jsonArrWeather.length(); i++) {
                    JSONObject jsonObjWeather = jsonArrWeather.optJSONObject(i);
                    if (jsonObjWeather != null) {
                        this.weatherList.add(new Weather(jsonObjWeather));
                    }
                }
            }
View Full Code Here

      return true;
    } else {
      if (node.has("children")) {
        JSONArray children = node.optJSONArray("children");
        for (int i = 0; i < children.length(); i++) {
          JSONObject child = children.optJSONObject(i);
          boolean res = hasKeyBoard(child);
          if (res) {
            return res;
          }
        }
View Full Code Here

    List<Cookie> res = new ArrayList<>();
    JSONObject o = sendCommand(Page.getCookies());
    JSONArray cookies = o.optJSONArray("cookies");
    if (cookies != null) {
      for (int i = 0; i < cookies.length(); i++) {
        JSONObject cookie = cookies.optJSONObject(i);
        String name = cookie.optString("name");
        String value = cookie.optString("value");
        String domain = cookie.optString("domain");
        String path = cookie.optString("path");
        Date expiry = new Date(cookie.optLong("expires"));
View Full Code Here

        .addAttribute("ref", from.optString("ref"));

    JSONArray array = from.optJSONArray("children");
    if (array != null) {
      for (int i = 0; i < array.length(); i++) {
        JSONObject n = array.optJSONObject(i);
        buildXMLNode(n, node);
      }
    }
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.