ObjectMapper mapper = new ObjectMapper().setDateFormat(new SimpleDateFormat(DATE_FORMAT));
//Can also use annotations for this
mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
ObjectWriter writer = mapper.writer();
Writer output = new StringWriter();
try {
writer.writeValue(output, object);
} catch (IOException e) {
log.error("Unable to serialize object to json", e);
}
return output.toString();