Include null field values in Jersey REST Response

1.2k Views Asked by At

I'm including Instance of Following class in one of my REST Resource Response.

public class GenericResponse<T> implements Serializable {
    private String message;

    private String errorMessage;

    private String errorCode = "0";

    ....
}

There are other fields in this class but, when a field is null or "0" (as a String), they are being omitted in the Client's Response.

How to include all fields in the Client's REST response even though they are null/empty/0

Additional Information: Jersey Version: 2.6

1

There are 1 best solutions below

0
On BEST ANSWER

I solved this with the Annotation

@JsonInclude(Include.ALWAYS)

on

GenericResponse