Skip to content

Instantly share code, notes, and snippets.

@ajermakovics
Created May 16, 2020 11:56
Show Gist options
  • Save ajermakovics/c47a6704fe010aeb8ecba6bfe3f0b7b8 to your computer and use it in GitHub Desktop.
Save ajermakovics/c47a6704fe010aeb8ecba6bfe3f0b7b8 to your computer and use it in GitHub Desktop.
Jackson ObjectMapper Config
public final static ObjectMapper mapper = new ObjectMapper()
.findAndRegisterModules()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
.configure(SerializationFeature.INDENT_OUTPUT, true)
.configure(Feature.ALLOW_COMMENTS, true)
.configure(Feature.ALLOW_SINGLE_QUOTES, true)
.configure(Feature.ALLOW_UNQUOTED_FIELD_NAMES, true)
.configure(Feature.ALLOW_YAML_COMMENTS, true)
.configure(Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true)
.setSerializationInclusion(JsonInclude.Include.NON_NULL);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment