code: public static String toPrettyJson(Object o) {
  		try {
  			return MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(o);
  		} catch (JsonProcessingException e) {
  			LoggerFactory
  			        .getLogger(Serializer.class)
  			        .error("Could not serialize the object. This will be ignored and the error will be written instead. Object was {}",
  			                o, e);
  			return "\"" + e.getMessage() + "\"";
  		}
  	}
docs: Serialize the object JSON. When an error occures return a string with the given error.