Examples of JSONArray


Examples of com.google.json.serialization.JsonArray

      preOrderVisitor.visit(node);
    }

    JsonValue childNode = node.get("children");
    if (childNode != JsonValue.NULL) {
      JsonArray children = childNode.asArray();

      for (int i = 0, n = children.getLength(); i < n; i++) {
        traverseImpl(children.get(i).asObject(), preOrderVisitor,
            postOrderVisitor);
      }
    }

    if (postOrderVisitor != null) {
View Full Code Here

Examples of com.granule.json.JSONArray

     * *param array An array instance to populate instead of creating a new one.
     *
     * @throws JSONException Thrown if a parse error occurs, such as a malformed JSON array.
     */
    public JSONArray parseArray(boolean ordered, JSONArray array) throws JSONException {
        JSONArray result = null;
        if(array != null){
            result = array;
        } else {
            result = new JSONArray();
        }

        try {
            if (lastToken != Token.TokenBrackL) throw new JSONException("Expecting '[' " + tokenizer.onLineCol());
            lastToken = tokenizer.next();
            while (true) {
                if (lastToken == Token.TokenEOF) throw new JSONException("Unterminated array " + tokenizer.onLineCol());

                /**
                 * End of the array.
                 */
                if (lastToken == Token.TokenBrackR) {
                    lastToken = tokenizer.next();
                    break;
                }

                Object val = parseValue(ordered);
                result.add(val);

                if (lastToken == Token.TokenComma) {
                    lastToken = tokenizer.next();
                } else if (lastToken != Token.TokenBrackR) {
                    throw new JSONException("expecting either ',' or ']' " + tokenizer.onLineCol());
View Full Code Here

Examples of com.hazelcast.com.eclipsesource.json.JsonArray

    public JsonObject toJson() {
        JsonObject root = new JsonObject();
        root.add("master", master);
        root.add("time", time);
        root.add("clusterName", clusterName);
        JsonArray instanceNames = new JsonArray();
        for (String instanceName : this.instanceNames) {
            instanceNames.add(instanceName);
        }
        root.add("instanceNames", instanceNames);
        if (memberList != null) {
            JsonArray members = new JsonArray();
            for (String member : memberList) {
                members.add(member);
            }
            root.add("memberList", members);
        }
        root.add("memberState", memberState.toJson());
        return root;
View Full Code Here

Examples of com.hp.hpl.jena.sparql.lib.org.json.JSONArray

public class JSONExporterCls implements JSONExporter {

  public JSONArray convertLTToJSON(Collection<LearningTool> learningTools)
      throws JSONException {

    JSONArray curArray = new JSONArray();

    for (int i = 0; i < learningTools.size(); i++) {

      JSONObject obj = new JSONObject();

      LearningTool currentltools = ((List<LearningTool>) learningTools)
          .get(i);

      DescriptionNode node = new SimpleDescriptionNodeFactory()
          .createNode(currentltools);

      obj.put("title", node.getTitle());
      obj.put("description", node.getDescription());
      obj.put("toolURL", node.getToolURl());
      obj.put("cost", node.getToolCost());
      obj.put("availability", node.getToolAvailability());
      obj.put("openSource", node.isOpenSource());
      obj.put("launched", node.getLaunchedTime());
      obj.put("registration", node.registration());
      obj.put("hasFeature", node.getFeatures());
      obj.put("supportedMobileDevices", node.getsupportedMobileDevice());
      obj.put("supportedOS", node.getsupportedOS());

      curArray.put(obj);

    }
    return curArray;
  }
View Full Code Here

Examples of com.jdroid.java.json.JSONArray

        List<Object> list = Lists.newArrayList();
       
        for (Object each : collection) {
          list.add(innerMarshall(each, mode, extras));
        }
        return new JSONArray(list);
      } else {
        return innerMarshall(object, mode, extras);
      }
    } else {
      return null;
View Full Code Here

Examples of com.liferay.portal.kernel.json.JSONArray

    if (Validator.isNotNull(layoutTemplateId)) {
      layoutTypePortlet.setLayoutTemplateId(
        userId, layoutTemplateId, false);
    }

    JSONArray columnsJSONArray = layoutJSONObject.getJSONArray("columns");

    addLayoutColumns(
      layout, LayoutTypePortletConstants.COLUMN_PREFIX, columnsJSONArray);

    LayoutLocalServiceUtil.updateLayout(
      groupId, layout.isPrivateLayout(), layout.getLayoutId(),
      layout.getTypeSettings());

    JSONArray layoutsJSONArray = layoutJSONObject.getJSONArray("layouts");

    addLayouts(privateLayout, layout.getLayoutId(), layoutsJSONArray);
  }
View Full Code Here

Examples of com.massivecraft.mcore.xlib.gson.JsonArray

    stack.add(element);
  }

  @Override public void beginArray() throws IOException {
    expect(JsonToken.BEGIN_ARRAY);
    JsonArray array = (JsonArray) peekStack();
    stack.add(array.iterator());
  }
View Full Code Here

Examples of com.netflix.staash.json.JsonArray

    int i = 0;
    System.out.println(jObj.isArray());
    }catch (Exception e) {
      e.printStackTrace();
    }
    JsonArray evts1 = new JsonArray(eventsStr);
    JsonArray events = new JsonArray();
    events.addString(eventsStr);
//    if (events.isArray()) {
//        JsonArray eventsArr = events.asArray();
//        JsonObject obj;
//        for (int i=0;obj = events.get(i); i++) {
//          JsonObject obj = (JsonObject) event;         
View Full Code Here

Examples of com.newrelic.org.json.simple.JSONArray

            reportAppError(json, status, path, msg.toString());
          }
        }
      }
       
        JSONArray customMetrics = (JSONArray) json.get("custom_metric");
      if (customMetrics != null) {
        for (Object key : customMetrics) {
          JSONObject metric = (JSONObject)key;
             
          String name = (String) metric.get("name");
View Full Code Here

Examples of com.oltpbenchmark.util.json.JSONArray

            assert(field_object != null);
            Stack<Class> inner_classes = new Stack<Class>();
            inner_classes.addAll(ClassUtil.getGenericTypes(field_handle));
            Collections.reverse(inner_classes);
           
            JSONArray json_inner =json_object.getJSONArray(json_key);
            if (json_inner == null) throw new JSONException("No array exists for '" + json_key + "'");
            readCollectionField(json_inner, (Collection)field_object, inner_classes);

        // Maps
        } else if (field_object instanceof Map) {
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.