Package com.fasterxml.jackson.core

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


        JsonFactory factory = new JsonFactory();
        try {
            JsonGenerator generator = factory.createJsonGenerator(outputFile, JsonEncoding.UTF8);
            generator.setPrettyPrinter(new DefaultPrettyPrinter());
            try {
                generator.writeStartObject();
                generator.writeFieldName("dependencies");
                writeDependenciesDelta(addedDeps, removedDeps, updatedDeps, generator);
                if (changeLog != null) {
                    generator.writeFieldName("scm");
                    writeChangeLog(generator, changeLog);
View Full Code Here


        jg.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false);

        final GraphSONUtility graphson = new GraphSONUtility(mode, null,
                ElementPropertyConfig.includeProperties(vertexPropertyKeys, edgePropertyKeys, normalize));

        jg.writeStartObject();

        jg.writeStringField(GraphSONTokens.MODE, mode.toString());

        jg.writeArrayFieldStart(GraphSONTokens.VERTICES);
View Full Code Here

    public void write(ReadableRepresentation representation, Set<URI> flags, Writer writer) {

        try {
            JsonGenerator g = getJsonGenerator(flags, writer);
            g.writeStartObject();
            renderJson(flags, g, representation, false);
            g.writeEndObject();
            g.close();
        } catch (IOException e) {
            throw new RepresentationException(e);
View Full Code Here

       
        StringWriter writer = new StringWriter();
        JsonGenerator generator = FACTORY.createGenerator(writer);
       
        MapEntriesAppendingMarker marker = Markers.appendEntries(map);
        generator.writeStartObject();
        marker.writeTo(generator);
        generator.writeEndObject();
        generator.flush();
       
        assertThat(writer.toString(), is("{\"myField\":\"value\"}"));
View Full Code Here

       
        StringWriter writer = new StringWriter();
        JsonGenerator generator = FACTORY.createGenerator(writer);
       
        ObjectFieldsAppendingMarker marker = Markers.appendFields(myObject);
        generator.writeStartObject();
        marker.writeTo(generator);
        generator.writeEndObject();
        generator.flush();
       
        assertThat(writer.toString(), is("{\"myField\":\"value\"}"));
View Full Code Here

       
        StringWriter writer = new StringWriter();
        JsonGenerator generator = FACTORY.createGenerator(writer);
       
        ObjectFieldsAppendingMarker marker = Markers.appendFields(Long.valueOf(1L));
        generator.writeStartObject();
        marker.writeTo(generator);
        generator.writeEndObject();
        generator.flush();
       
        assertThat(writer.toString(), is("{}"));
View Full Code Here

       
        StringWriter writer = new StringWriter();
        JsonGenerator generator = FACTORY.createGenerator(writer);
       
        RawJsonAppendingMarker marker = Markers.appendRaw("rawJson", rawJson);
        generator.writeStartObject();
        marker.writeTo(generator);
        generator.writeEndObject();
        generator.flush();
       
        assertThat(writer.toString(), is("{\"rawJson\":{\"myField\":\"value\"}}"));
View Full Code Here

       
        StringWriter writer = new StringWriter();
        JsonGenerator generator = FACTORY.createGenerator(writer);
       
        ObjectAppendingMarker marker = Markers.append("myObject", myObject);
        generator.writeStartObject();
        marker.writeTo(generator);
        generator.writeEndObject();
        generator.flush();
       
        assertThat(writer.toString(), is("{\"myObject\":{\"myField\":\"value\"}}"));
View Full Code Here

      JsonFactory jsonFactory = new JsonFactory();
     
      JsonGenerator jgen = jsonFactory.createGenerator(output);
      jgen.setCodec(new ObjectMapper());
     
      jgen.writeStartObject();
       
        if(ps == null) {
          jgen.writeObjectFieldStart("properties"); {
            if (id != null)
              jgen.writeStringField("id", id);
View Full Code Here

    try {
      JsonFactory jsonFactory = new JsonFactory(); // ObjectMapper.getJsonFactory()
                              // is better
      JsonGenerator jgen = jsonFactory.createGenerator(out);
      jgen.setCodec(new ObjectMapper());
      jgen.writeStartObject();
      {

        jgen.writeStringField("type", "FeatureCollection");

        writeJsonProperties(jgen);
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.