8

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.

Sotirios Delimanolis
  • 274,122
  • 60
  • 696
  • 724
Oliver.Oakley
  • 628
  • 2
  • 7
  • 23
  • You don't show the code of your POJO nor the JSON you try to deserialize; difficult to tell in these conditions. But the error seems to be that there are object members not present in the POJO definition. – fge Mar 13 '14 at 21:32
  • 1
    possible duplicate of [Jackson with JSON: Unrecognized field, not marked as ignorable](http://stackoverflow.com/questions/4486787/jackson-with-json-unrecognized-field-not-marked-as-ignorable) – chenrui Feb 05 '15 at 01:28

2 Answers2

16

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

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

@JsonIgnoreProperties(ignoreUnknown=true)
fge
  • 119,121
  • 33
  • 254
  • 329
3

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

Community
  • 1
  • 1
NathanChristie
  • 2,374
  • 21
  • 20