Category Archives: JSON

Do not serialize null values – jackson objectMapper (@JsonInclude)

Given a list of user defined objects or POJO and object may contains the null values. When we are converting list of objects to JSON, we do not want to serialize the null values. We have already discussed about serialization of non-null values using setSerializationInclusion . We will use the JsonInclude annotation Jackson’s ObjectMapper to block serialization of nulls.… Read More »

Serialize non null values of list of objects – Jackson ObjectMapper (example)

Given the list of user defined objects or POJO and object may contains null values. When we are converting list of objects to JSON, we do not want to serialize the null values. We have already discussed about not serializating of empty values.  We will use setSerializationInclusion feature of Jackson’s ObjectMapper to block serialization of nulls. We will… Read More »

Convert object having date to/from JSON in java (Jackson ObjectMapper example)

Given the user defined object or POJO having date field, we would like to serialize the POJO to JSON. During serialization, we would like save date as a timestamp or ISO format. We will use the Jackson’s ObjectMapper to achieve the conversion. We will create Person class and we will perform the following operations with Person class. Convert Person… Read More »

Convert list of objects to/from JSON in java (jackson objectmapper/ example)

Given a list of user defined objects, we would like to convert list of pojo objects to JSON (and JSON to list of objects). We will use the jackson’s objectmapper, to serialize list of objects to JSON & deserialize JSON to List of objects. We will create Person class & we will perform following operations with Person class. Convert List of… Read More »

Page 1 of 212