Skip to content
Sharp

Networking · interview question

How can you configure the ObjectMapper to handle a JSON input with unknown properties gracefully?

Multiple choiceMediumchapter-11-curatedpremiumnetworkingjackson-objectmapper
java
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
Choose one answer
Answer and explanation

Correct answer

B. ObjectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

Why

By setting FAIL_ON_UNKNOWN_PROPERTIES to false, the ObjectMapper will ignore any JSON properties that don't match the fields in your Java class, preventing exceptions during deserialization.

Test yourself on Networking

A free test with instant, explained results. No account needed.

Start free test
All Networking questions →