Examples of writerWithDefaultPrettyPrinter()


Examples of org.codehaus.jackson.map.ObjectMapper.writerWithDefaultPrettyPrinter()

  private String prettyPrintIfJson(String maybeJson) {
    JsonFactory factory = new JsonFactory();
    ObjectMapper mapper = new ObjectMapper(factory);
    TypeReference<HashMap<String,Object>> typeRef = new TypeReference<HashMap<String,Object>>() {};
    try {
      return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(mapper.readValue(maybeJson, typeRef));
    }
    catch (IOException e) {
      // Not JSON? Return unchanged
      return maybeJson;
    }
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper.writerWithDefaultPrettyPrinter()

      getLog().info("Writing results into " + outputFile.getName());
     
      try {
        ObjectMapper objectMapper = new ObjectMapper();
       
        ObjectWriter writer = objectMapper.writerWithDefaultPrettyPrinter();
       
        writer.writeValue(outputFile, result.getEnvironments());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
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.