Class JsonFormatter

java.lang.Object
io.dropwizard.logging.json.layout.JsonFormatter

public class JsonFormatter extends Object
Formats objects to JSON strings according to the configured ObjectMapper and output parameters.
  • Constructor Summary

    Constructors
    Constructor
    Description
    JsonFormatter(com.fasterxml.jackson.databind.ObjectMapper objectMapper, boolean prettyPrint, boolean doesAppendLineSeparator)
     
    JsonFormatter(com.fasterxml.jackson.databind.ObjectMapper objectMapper, boolean prettyPrint, boolean doesAppendLineSeparator, int bufferSize)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable String
    toJson(@Nullable Map<String,Object> map)
    Converts the provided map as a JSON object according to the configured JSON mapper.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JsonFormatter

      public JsonFormatter(com.fasterxml.jackson.databind.ObjectMapper objectMapper, boolean prettyPrint, boolean doesAppendLineSeparator, int bufferSize)
    • JsonFormatter

      public JsonFormatter(com.fasterxml.jackson.databind.ObjectMapper objectMapper, boolean prettyPrint, boolean doesAppendLineSeparator)
  • Method Details

    • toJson

      public @Nullable String toJson(@Nullable Map<String,Object> map)
      Converts the provided map as a JSON object according to the configured JSON mapper.
      Parameters:
      map - the provided map
      Returns:
      the JSON as a string