Package org.json

Examples of org.json.JSONStringer.key()


      PrintWriter printWriter = new PrintWriter(outputStream);
      try
      {
         JSONStringer json = new JSONStringer();
         json.object().key("description").value(model.getDescription());
         json.key("children").array();
         for (String child : model.getChildren())
         {
            json.object().key("name").value(child);
            NamedDescription nd = model.getChildDescription(child);
            if (nd != null)
View Full Code Here


         {
            json.object().key("name").value(child);
            NamedDescription nd = model.getChildDescription(child);
            if (nd != null)
            {
               json.key("description").value(nd.getDescription());
            }
            json.endObject();
         }
         json.endArray().key("operations").array();
         for (NamedDescription nd : model.getOperations())
View Full Code Here

      Json.writeObject(writer, "dropdownCssClass", dropdownCssClass);
      Json.writeObject(writer, "separator", separator);
      Json.writeObject(writer, "tokenSeparators", tokenSeparators);
      Json.writeObject(writer, "dropdownAutoWidth", dropdownAutoWidth);
      if (ajax != null) {
    writer.key("ajax");
    ajax.toJson(writer);
      }
      Json.writeFunction(writer, "data", data);
      Json.writeFunction(writer, "tags", tags);
      writer.endObject();
View Full Code Here

        stringer.object();

        for (Map.Entry<String, Object> param : params.entrySet()) {
            if (param.getKey() != null && !"".equals(param.getKey()) && param.getValue() != null && !""
                .equals(param.getValue())) {
                stringer.key(param.getKey()).value(param.getValue());
            }
        }

        return stringer.endObject().toString();
    }
View Full Code Here

        JSONStringer stringer = new JSONStringer();
        try {
            stringer.object();
            super.toJSONString(stringer);

            stringer.key(Members.EXECUTE_LIST.name()).array();
            for (AbstractPlanNode node : m_list) {
                stringer.value(node.getPlanNodeId().intValue());
            }
            stringer.endArray(); //end execution list
View Full Code Here

      Json.writeObject(writer, "dropdownCss", dropdownCss);
      Json.writeObject(writer, "dropdownCssClass", dropdownCssClass);
      Json.writeObject(writer, "separator", separator);
      Json.writeObject(writer, "tokenSeparators", tokenSeparators);
      if(ajax != null) {
    writer.key("ajax");
    ajax.toJson(writer);
      }

      Json.writeFunction(writer, "data", data);
      Json.writeFunction(writer, "tags", tags);
View Full Code Here

        if (override.isEmpty() == false) {
            JSONStringer stringer = new JSONStringer();
            try {
                stringer.object();
                for (Entry<String, String> e : override.entrySet()) {
                    stringer.key(e.getKey().toUpperCase()).value(e.getValue());
                } // FOR
                stringer.endObject();
                this.fromJSON(new JSONObject(stringer.toString()), catalog_db);
            } catch (JSONException ex) {
                throw new IOException("Failed to load override parameters: " + override, ex);
View Full Code Here

           
            // First construct an index that allows us to quickly find the partitions that we want
            JSONStringer stringer = (JSONStringer)(new JSONStringer().object());
            int offset = 1;
            for (Integer partition : sorted) {
                stringer.key(partition.toString()).value(offset++);
            } // FOR
            out.write((stringer.endObject().toString() + "\n").getBytes());
           
            // Now Loop through each file individually so that we only have to load one into memory at a time
            for (Integer partition : sorted) {
View Full Code Here

                    JSONObject json_object = new JSONObject(FileUtil.readFile(in));
                    MarkovGraphsContainer markov = MarkovGraphsContainerUtil.createMarkovGraphsContainer(json_object, procedures, catalog_db);
                    markov.load(in, catalog_db);
                   
                    stringer = (JSONStringer)new JSONStringer().object();
                    stringer.key(partition.toString()).object();
                    markov.toJSON(stringer);
                    stringer.endObject().endObject();
                    out.write((stringer.toString() + "\n").getBytes());
                } catch (Exception ex) {
                    throw new Exception(String.format("Failed to copy MarkovGraphsContainer for partition %d from '%s'", partition, in), ex);
View Full Code Here

           
            // First construct an index that allows us to quickly find the partitions that we want
            JSONStringer stringer = (JSONStringer)(new JSONStringer().object());
            int offset = 1;
            for (Integer partition : sorted) {
                stringer.key(Integer.toString(partition)).value(offset++);
            } // FOR
            out.write((stringer.endObject().toString() + "\n").getBytes());
           
            // Now roll through each id and create a single JSONObject on each line
            for (Integer partition : sorted) {
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.