How not to serialize some attributes in RESTful calls with Jersey and Jackson

2

I'm using the Jersey library in conjunction with the Jackson library to use REST-type web services. In calls, I usually use the following code that transforms a given entity into a JSON to be sent in the request body.

Map<String, Object> response = api.request().post(Entity.json(entidade), Map.class);

The point is that there are some attributes in the entidade to be sent that I wish would not be serialized as JSON in the request and would be missing from it.

Is there any% c or% or something of the type in which it is possible to determine attributes that should not be serialized in this type of request?

    
asked by anonymous 31.01.2014 / 17:49

1 answer

1

To ignore an attribute in serialization, I used the annotation org.codehaus.jackson.annotate.JsonIgnore from the Jackson library itself. It should be placed in the attribute to be ignored according to the following example:

@JsonIgnore
private MeuObjeto objeto;
    
31.01.2014 / 18:01