Examples of writeValueAsString()


Examples of com.fasterxml.jackson.databind.ObjectWriter.writeValueAsString()

        FilterProvider filters = new SimpleFilterProvider().addFilter("Filter properties from the PathController GET",
              SimpleBeanPropertyFilter.serializeAllExcept(ignorableFieldNames));
   
        ObjectWriter writer = objectMapper.writer(filters);

        return writer.writeValueAsString(jqReturn);
    }
   

    /**
     * Get information for a specific path name/profileId or pathId
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectWriter.writeValueAsString()

        }

        ObjectMapper objectMapper = new ObjectMapper();
        ObjectWriter writer = objectMapper.writer();

        return writer.writeValueAsString(PathOverrideService.getInstance().getPath(pathId, clientUUID, null));
    }

    // setOverrideArgs needs direct access to HttpServletRequest since Spring messes up array entries with commas
    @Autowired
    private HttpServletRequest httpRequest;
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectWriter.writeValueAsString()

            response().setContentType(MediaType.JSON_UTF_8.toString());
            response().setHeader("Content-Disposition", "attachment; filename=content_pack.json");
            ObjectMapper m = new ObjectMapper();
            ObjectWriter ow = m.writer().withDefaultPrettyPrinter();
            return ok(ow.writeValueAsString(bundle));
        } catch (IOException e) {
            flash("error", "Could not reach Graylog2 server");
        } catch (Exception e) {
            flash("error", "Unexpected error exporting configuration bundle, please try again later");
        }
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.xml.XmlMapper.writeValueAsString()

        WrappedList list = new WrappedList();
        list.value = new Value[] { new Value("a"), new Value("b") };

        // First, serialize:
       
        String json = mapper.writeValueAsString(list);
//      withJAXB(list);
        assertEquals("<list><WRAP><value><v>a</v></value><value><v>b</v></value></WRAP></list>", json);

        // then deserialize back
        WrappedList output = mapper.readValue(json, WrappedList.class);
View Full Code Here

Examples of com.fasterxml.jackson.xml.XmlMapper.writeValueAsString()

    // make deserializer use JAXB annotations (only)
    mapper.getDeserializationConfig().setAnnotationIntrospector(ai);
      // make serializer use JAXB annotations (only)
      mapper.getSerializationConfig().setAnnotationIntrospector(ai);
    try {
      xml = mapper.writeValueAsString(rp);
    } catch (Exception ex) {
     
    }
    return xml;
  }
View Full Code Here

Examples of com.github.miemiedev.mybatis.paginator.jackson2.PageListJsonMapper.writeValueAsString()

        PageList pageList = (PageList)list;
        System.out.println("totalCount: " + pageList.getPaginator().getTotalCount());

        //Convert to json , for spring mvc
        ObjectMapper objectMapper = new PageListJsonMapper();
        System.out.println(objectMapper.writeValueAsString(list));
    }

    public List findByCity(String city, PageBounds pageBounds){
        SqlSession session = null;
        try{
View Full Code Here

Examples of com.knappsack.swagger4springweb.util.ScalaObjectMapper.writeValueAsString()

        Map<String, ApiListing> documentList = createApiParser().createApiListings();
        for (String key : documentList.keySet()) {
            ApiListing documentation = documentList.get(key);
            ScalaObjectMapper mapper = new ScalaObjectMapper();
            try {
                String documentationAsJSON = mapper.writeValueAsString(documentation);
                System.out.println(documentationAsJSON);
                ApiListing documentationDeserialized = JsonSerializer.asApiListing(documentationAsJSON);
                assertNotNull(documentationDeserialized);
                assertTrue(documentationDeserialized.swaggerVersion().equals(SwaggerSpec.version()));
                assertTrue(documentationDeserialized.apiVersion().equals("v1"));
View Full Code Here

Examples of com.netflix.suro.jackson.DefaultObjectMapper.writeValueAsString()

                "staticRoutingKey",
                null,
                new DefaultObjectMapper());

        Map<String, Object> msgMap = new ImmutableMap.Builder<String, Object>().put("f1", "v1").put("f2", "v2").build();
        List<MessageContainer> messages = jsonLine.parse(jsonMapper.writeValueAsString(msgMap));
        assertEquals(messages.size(), 1);
        assertEquals(messages.get(0).getRoutingKey(), "staticRoutingKey");
        assertEquals(messages.get(0).getEntity(S3Consumer.typeReference), msgMap);
    }
View Full Code Here

Examples of io.druid.jackson.DefaultObjectMapper.writeValueAsString()

            null, null, null, null, null, null, null, null, false, false
        ),
        null, null, null, null
    );

    String json = jsonMapper.writeValueAsString(schema);

    FireDepartment newSchema = jsonMapper.readValue(json, FireDepartment.class);

    Assert.assertEquals(schema.getDataSchema().getDataSource(), newSchema.getDataSchema().getDataSource());
  }
View Full Code Here

Examples of org.apache.logging.log4j.core.jackson.Log4jJsonObjectMapper.writeValueAsString()

    @Test
    public void testJsonIoContainer() throws IOException {
        ObjectMapper objectMapper = new Log4jJsonObjectMapper();
        Fixture expected = new Fixture();
        final String s = objectMapper.writeValueAsString(expected);
        Fixture actual = objectMapper.readValue(s, Fixture.class);
        assertEquals(expected.proxy.getName(), actual.proxy.getName());
        assertEquals(expected.proxy.getMessage(), actual.proxy.getMessage());
        assertEquals(expected.proxy.getLocalizedMessage(), actual.proxy.getLocalizedMessage());
        assertEquals(expected.proxy.getCommonElementCount(), actual.proxy.getCommonElementCount());
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.