Package com.sdicons.json.model

Examples of com.sdicons.json.model.JSONArray


      JSONValue jsonObject = parser.nextValue();
      if (jsonObject.isComplex()) {

        JSONObject complex = (JSONObject) jsonObject;
        JSONObject jsonResults = (JSONObject) complex.get("results");
        JSONArray bindings = (JSONArray) jsonResults.get("bindings");
        for (int i = 0; i < bindings.getValue().size(); i++) {
          Map<String, String> result = new HashMap<String, String>();
          cont++;
          JSONObject jsonResult = (JSONObject) bindings.get(i);
          for (String var : getVariablesFromJson(complex)) {
            JSONObject element = (JSONObject) jsonResult.get(var);
            String value = null;
            if (element != null) {
              String type = ((JSONString) element.get("type"))
View Full Code Here


  }

  private LinkedList<String> getVariablesFromJson(JSONObject complex) {
    LinkedList<String> variables = new LinkedList<String>();
    JSONObject jsonHead = (JSONObject) complex.get("head");
    JSONArray vars = (JSONArray) jsonHead.get("vars");
    for (int i = 0; i < vars.getValue().size(); i++) {
      variables.add(((JSONString) vars.get(i)).getValue());
    }
    return variables;
  }
View Full Code Here

      out.setIdProperty(Helper.getIntRequired(jsonObject, "idProperty",
        "AjProperty property idProperty was not found in json data"));
      out.setName(Helper.getStringRequired(jsonObject, "name",
        "AjProperty property name was not found in json data"));
      out.setValues(new ArrayList<AjPropertyValue>());
      JSONArray array = (JSONArray) jsonObject.get("values");
      for (JSONValue jsonValue : array.getValue()) {
    out.getValues().add(
      (AjPropertyValue) JSONMapper.toJava(jsonValue, AjPropertyValue.class));
      }
      return out;
  }
View Full Code Here

      if (list == null) {
    throw new MapperException(
      "AjPageable property currentPage was not found in json data");
      } else {
    out.setCurrentPage(new ArrayList<AjLegoBox>());
    JSONArray array = (JSONArray) list;
    for (JSONValue jsonValue : array.getValue()) {
        out.getCurrentPage().add(
          (AjLegoBox) JSONMapper.toJava(jsonValue, AjLegoBox.class));
    }

      }
View Full Code Here

        jsonObject.get("idPropertyValues"), LinkedList.class));

      out.setIdPropertyValues(new ArrayList<Integer>());
      if (jsonObject.get("idPropertyValues") != null
        && jsonObject.get("idPropertyValues") instanceof JSONArray) {
    JSONArray array = (JSONArray) jsonObject.get("idPropertyValues");
    for (JSONValue jsonValue : array.getValue()) {
        out.getIdPropertyValues().add(
          (Integer) JSONMapper.toJava(jsonValue, Integer.class));
    }
      }
      return out;
View Full Code Here

TOP

Related Classes of com.sdicons.json.model.JSONArray

Copyright © 2018 www.massapicom. 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.