Serialization of null values when converting from java object to json format

In this post I will explain how serialization of null values feature can be turned on or off. Below is the class structure of the object to be serialized Student 1 import javax.json.bind.annotation.JsonbProperty; 2 3 public class Student { 4 private int id; 5 private String name; 6 private Integer rollnum; 7 8 public int…… Continue reading Serialization of null values when converting from java object to json format

Preventing an property from being serialized to json

By default when an object is serialized to json format, all the properties in the object are serialized. We can prevent this default behavior, by annotating the property with @JsonbTransient annotation. Below is the example. The class to be serialized is Employee Employee 1 import javax.json.bind.annotation.JsonbTransient; 2 3 public class Employee { 4 private int…… Continue reading Preventing an property from being serialized to json