Bird
0
0

What does the @JsonProperty annotation do in Jackson serialization?

easy📝 Conceptual Q2 of 15
Spring Boot - Request and Response Handling
What does the @JsonProperty annotation do in Jackson serialization?
AIncludes only non-null fields
BExcludes the field from JSON
CChanges the JSON field name
DFormats date fields
Step-by-Step Solution
Solution:
  1. Step 1: Review @JsonProperty purpose

    @JsonProperty lets you rename the JSON key for a Java field.
  2. Step 2: Understand effect on serialization

    It changes the field name in the JSON output but keeps the value.
  3. Final Answer:

    @JsonProperty changes the JSON field name -> Option C
  4. Quick Check:

    Rename JSON field = @JsonProperty [OK]
Quick Trick: Use @JsonProperty to rename JSON keys easily [OK]
Common Mistakes:
  • Thinking it excludes fields
  • Confusing with @JsonIgnore
  • Assuming it formats values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes