Skip to content
Sharp

Networking · interview question

Which annotation would you use in Jackson to change the name of a field during serialization?

Multiple choiceMediumchapter-11-curatedpremiumnetworkingjackson-objectmapper
Choose one answer
Answer and explanation

Correct answer

A. @JsonProperty

Why

The @JsonProperty annotation allows you to specify a different name for a field in the JSON output. By using @JsonProperty("newName"), the field can be serialized under the specified name instead of the default field name.

Test yourself on Networking

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

Start free test
All Networking questions →