private static final ObjectMapper mapper = newMapper();
private static ObjectMapper newMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.enable(SerializationFeature.INDENT_OUTPUT);
mapper.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false);
mapper.configure(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT, false);
mapper.disable(SerializationFeature.FLUSH_AFTER_WRITE_VALUE);
mapper.disable(SerializationFeature.CLOSE_CLOSEABLE);
mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);