Oliver.Oakley
Oliver.Oakley

Reputation: 668

org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "id" (Class Criteria), not marked as ignorable

I am getting this exception when I am trying to parse Json to Java pojo object. The object graph has couple objects.

org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "id" (Class Criteria), not marked as ignorable

I wanted to see, in which case this exception will come, where could be the problem is it in the object graph??

I am doing this in my android project I am not using annotations here I am not sure how to add this field as ignorable.

Upvotes: 8

Views: 31152

Answers (2)

NathanChristie
NathanChristie

Reputation: 2400

This will also happen if you have defined the field in your POJO, but do not have a getter AND setter methods defined. Ignoring the field may have unintended consequences.

This does look to be a duplicate of: Jackson with JSON: Unrecognized field, not marked as ignorable

Upvotes: 3

fge
fge

Reputation: 121702

You don't show any code, so...

Anyway, try and add this annotation to the class you deserialize:

@JsonIgnoreProperties(ignoreUnknown=true)

Upvotes: 16

Related Questions