Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 641
Oliver.Oakley Avatar asked Mar 13 '14 21:03

Oliver.Oakley


2 Answers

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

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

@JsonIgnoreProperties(ignoreUnknown=true)
like image 85
fge Avatar answered Nov 14 '22 07:11

fge


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

like image 3
NathanChristie Avatar answered Nov 14 '22 07:11

NathanChristie