Package com.fasterxml.jackson.core

Examples of com.fasterxml.jackson.core.JsonGenerator.writeStartArray()


      @Override
      public void visit(MetricTreeArray o) {
        try {
          writeKey(o);
          jsonGenerator.writeStartArray();
          o.visitItems(this);
          jsonGenerator.writeEndArray();
        } catch (IOException e) {
          throw new IllegalStateException("Error serializing to JSON", e);
        }
View Full Code Here


            jg.writeFieldName("inputs");
            writeInput(jg);

            jg.writeFieldName("query");
            jg.writeStartArray();

            writePhases(jg);

            jg.writeEndArray();
            if (timeout != null) {
View Full Code Here

          Class type = (Class) en.getMethod("getType").invoke(v);
            String subsection = key.substring(0, key.indexOf('.'));
            if (!lastSection.equals(subsection)) {
            if (gen.getOutputContext().inArray()) gen.writeEndArray();
              gen.writeFieldName(subsection);                                    //      "sectionName":
              gen.writeStartArray();                                        //        [
              lastSection = subsection;
           
            boolean isOverridden = (Boolean)(en.getMethod("isOverridden")).invoke(v);
            gen.writeStartObject();                                        //          {
            gen.writeStringField(key,valueAsString);                              //              "key": "value" 
View Full Code Here

    ObjectMapper mapper = new ObjectMapper();
    JsonFactory jfactory = mapper.getJsonFactory();
    StringWriter sw = new StringWriter()
    try{
      JsonGenerator gen = jfactory.createJsonGenerator(sw);
      gen.writeStartArray()
      for (String v: keys){
        String st = dumpConfigurationAsJson(v);
        ObjectMapper op= new ObjectMapper();
        JsonNode p = op.readTree(st);
        Logger.debug("OBJECT:" + p.toString());
View Full Code Here

    try {
      JsonFactory jfactory = new JsonFactory();
      StringWriter sw = new StringWriter();
      String enumDescription = "";     
      JsonGenerator gen = jfactory.createJsonGenerator(sw);
      gen.writeStartArray()
      EnumSet values = EnumSet.allOf( en );
      for (Object v : values) {
          String key=(String) (en.getMethod("getKey")).invoke(v);
         
         
View Full Code Here

      // don't forget jsonp
      if (jsonp != null && !jsonp.isEmpty()) {
        output.write((jsonp + "(").getBytes(query.getCharset()));
      }
      JsonGenerator json = JSON.getFactory().createGenerator(output);
      json.writeStartArray();
     
      for (DataPoints[] separate_dps : results) {
        for (DataPoints dps : separate_dps) {
          json.writeStartObject();
         
View Full Code Here

            }
          }
          json.writeEndObject();
         
          json.writeFieldName("aggregateTags");
          json.writeStartArray();
          if (dps.getAggregatedTags() != null) {
            for (String atag : dps.getAggregatedTags()) {
              json.writeString(atag);
            }
          }
View Full Code Here

          }
          json.writeEndArray();
         
          if (data_query.getShowTSUIDs()) {
            json.writeFieldName("tsuids");
            json.writeStartArray();
            final List<String> tsuids = dps.getTSUIDs();
            Collections.sort(tsuids);
            for (String tsuid : tsuids) {
              json.writeString(tsuid);
            }
View Full Code Here

          // now the fun stuff, dump the data
          json.writeFieldName("dps");
         
          // default is to write a map, otherwise write arrays
          if (as_arrays) {
            json.writeStartArray();
            for (final DataPoint dp : dps) {
              if (dp.timestamp() < data_query.startTime() ||
                  dp.timestamp() > data_query.endTime()) {
                continue;
              }
View Full Code Here

                  dp.timestamp() > data_query.endTime()) {
                continue;
              }
              final long timestamp = data_query.getMsResolution() ?
                  dp.timestamp() : dp.timestamp() / 1000;
              json.writeStartArray();
              json.writeNumber(timestamp);
              if (dp.isInteger()) {
                json.writeNumber(dp.longValue());
              } else {
                json.writeNumber(dp.doubleValue());
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.