Package org.codehaus.jackson

Examples of org.codehaus.jackson.JsonGenerator.writeTree()


        try {
            JsonFactory jsonFactory = getJsonFactory();
            StringWriter sw = new StringWriter();
            JsonGenerator generator = jsonFactory.createJsonGenerator(sw);
            JsonNode node = parser.readValueAs(JsonNode.class);
            generator.writeTree(node);
            return sw.toString();
        } catch (IOException e) {
            throw new IllegalArgumentException(e);
        }
    }
View Full Code Here


    public static void write(JsonNode node, OutputStream out) {
        try {
            JsonFactory jsonFactory = getJsonFactory();
            JsonGenerator generator = jsonFactory.createJsonGenerator(out, JsonEncoding.UTF8);
            generator.writeTree(node);
        } catch (IOException e) {
            throw new IllegalArgumentException(e);
        }
    }
View Full Code Here

        }
        responseNode.put("results", resultsArray);

        rootNode.put("response", responseNode);
        JsonGenerator generator = this.jsonFactory.createJsonGenerator(out, JsonEncoding.UTF8);
        generator.writeTree(rootNode);
        generator.close();
    }

    public JsonNode makeNode(IBaseObject object) throws IOException
    {
View Full Code Here

                // No special fields.
            }
            array.add(node);
        }
        JsonGenerator generator = this.jsonFactory.createJsonGenerator(out, JsonEncoding.UTF8);
        generator.writeTree(array);
        generator.close();
    }

    protected void write(Calendar calendar, OutputStream out) throws IOException
    {
View Full Code Here

        node.put("supplementals", makeArrayNode(calendar.getSupplementals()));

        ObjectNode wrapper = objectMapper.createObjectNode();
        wrapper.put("meeting", node);
        JsonGenerator generator = this.jsonFactory.createJsonGenerator(out, JsonEncoding.UTF8);
        generator.writeTree(wrapper);
        generator.close();
    }

    protected void write(Meeting meeting, OutputStream out) throws IOException
    {
View Full Code Here

        node.put("bills", makeArrayNode(meeting.getBills()));

        ObjectNode wrapper = objectMapper.createObjectNode();
        wrapper.put("meeting", node);
        JsonGenerator generator = this.jsonFactory.createJsonGenerator(out, JsonEncoding.UTF8);
        generator.writeTree(wrapper);
        generator.close();
    }

    protected void write(Transcript transcript, OutputStream out) throws IOException
    {
View Full Code Here

        node.put("text", transcript.getTranscriptText());

        ArrayNode wrapper = objectMapper.createArrayNode();
        wrapper.add(node);
        JsonGenerator generator = this.jsonFactory.createJsonGenerator(out, JsonEncoding.UTF8);
        generator.writeTree(wrapper);
        generator.close();
    }

    protected void write(Bill bill, OutputStream out) throws IOException
    {
View Full Code Here

        node.put("cosponsors", cosponsors);

        ArrayNode wrapper = objectMapper.createArrayNode();
        wrapper.add(node);
        JsonGenerator generator = this.jsonFactory.createJsonGenerator(out, JsonEncoding.UTF8);
        generator.writeTree(wrapper);
        generator.close();
    }

    protected JsonNode makeNode(Supplemental supplemental)
    {
View Full Code Here

        node.put("session", transcript.getSession());
        node.put("modified", makeNode(transcript.getModifiedDate()));
        node.put("published", makeNode(transcript.getPublishDate()));
        node.put("dataSources", makeArrayNode(transcript.getDataSources()));
        JsonGenerator generator = this.jsonFactory.createJsonGenerator(out, JsonEncoding.UTF8);
        generator.writeTree(node);
        generator.close();
    }

    public void write(Calendar calendar, OutputStream out) throws IOException
    {
View Full Code Here

        node.put("active", calendar.isActive());
        node.put("modified", makeNode(calendar.getModifiedDate()));
        node.put("published", makeNode(calendar.getPublishDate()));
        node.put("dataSources", makeArrayNode(calendar.getDataSources()));
        JsonGenerator generator = this.jsonFactory.createJsonGenerator(out, JsonEncoding.UTF8);
        generator.writeTree(node);
        generator.close();
    }

    public Calendar readCalendar(Reader reader) throws JsonProcessingException, IOException
    {
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.