Thursday, December 29, 2022

JSON to Java Cheat Notes

In this article we will talk about exposing java to Json serialization and how to instrument them

  @JsonProperty( "fieldName" ) // Changing the field name

  @JsonUnwrapped // Expose child attributes to parent/holder directly instead of as a child

  @JsonRootName(value = "user") // Giving root name to the json

  @JsonSerialize(using = SomeCustomSerializer.class) // serializer class

  @JsonDeserialize(using = SomeCustomDeserializer.class) // deserializer class

   JSON to Java schema conversion. :https://www.jsonschema2pojo.org/


No comments:

Post a Comment