Package com.fasterxml.jackson.core

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


        ObjectMapper op= new ObjectMapper();
        JsonNode p = op.readTree(st);
        Logger.debug("OBJECT:" + p.toString());
        Logger.debug("STRING:" + st);
        //JsonParser jp = jfactory.createJsonParser(st);
        gen.writeTree(p);
      }
      gen.writeEndArray();
      gen.close();
      return sw.toString();
    }catch (Exception e) {
View Full Code Here


      gen = new JsonFactory().createGenerator(writer);
      if (pretty) {
        gen.useDefaultPrettyPrinter();
      }
      gen.setCodec(new ObjectMapper());
      gen.writeTree(toJson(strategy));
      gen.close();
    } catch (IOException e) {
      throw new DatasetIOException("Cannot write to JSON generator", e);
    }
    return writer.toString();
View Full Code Here

    StringWriter writer = new StringWriter();
    JsonGenerator gen;
    try {
      gen = new JsonFactory().createGenerator(writer);
      gen.setCodec(new ObjectMapper());
      gen.writeTree(toJson(mapping));
      gen.close();
    } catch (IOException e) {
      throw new DatasetIOException("Cannot write to JSON generator", e);
    }
    return writer.toString();
View Full Code Here

      gen = new JsonFactory().createGenerator(writer);
      if (pretty) {
        gen.useDefaultPrettyPrinter();
      }
      gen.setCodec(new ObjectMapper());
      gen.writeTree(toJson(mapping));
      gen.close();
    } catch (IOException e) {
      throw new DatasetIOException("Cannot write to JSON generator", e);
    }
    return writer.toString();
View Full Code Here

        jg.writeArrayFieldStart(GraphSONTokens.VERTICES);

        final Iterable<Vertex> vertices = vertices(normalize);
        for (Vertex v : vertices) {
            jg.writeTree(graphson.objectNodeFromElement(v));
        }

        jg.writeEndArray();

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

        jg.writeArrayFieldStart(GraphSONTokens.EDGES);

        final Iterable<Edge> edges = edges(normalize);
        for (Edge e : edges) {
            jg.writeTree(graphson.objectNodeFromElement(e));
        }
        jg.writeEndArray();

        jg.writeEndObject();
View Full Code Here

      StringWriter out = new StringWriter();
      JsonGenerator jsonGenerator = mapper.getJsonFactory().createJsonGenerator( out );

      jsonGenerator.useDefaultPrettyPrinter();
      jsonGenerator.writeTree( tree );

      return out.toString();
    } catch ( Exception ignore ) {
      //Do not format if it is not possible...
      return String.valueOf( unformated );
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.