0

The mapper call is as follows:

String sampleJson; //sample string 
PojoClass data = mapper.readValue(sampleJson, PojoClass.class);

The following error is thrown for the isDeleted field:

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "isDeleted"

at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:60)
    at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:823)
    at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1153)
...
andrewJames
  • 19,570
  • 8
  • 19
  • 51
  • 2
    please post your code. – rhowell Mar 18 '20 at 19:54
  • Its simple pojo class which is throwing an error while parsing String sampleJson;//sample string PojoClass data = mapper.readValue(sampleJson, PojoClass.class); – abhishek ujjain Mar 18 '20 at 19:57
  • Can you post your code in your question, as formatted text (i.e. not in a comment)? Can you include your pojo? A sample of the JSON would also help. More generally, you should try to provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). – andrewJames Mar 18 '20 at 21:38

1 Answers1

0

You should add @JsonIgnoreProperties(ignoreUnknown = true) annotation to your PojoClass.java b/c you're incoming json has a property that isn't defined in your PojoClass (or remove any property in your json that isn't defined in the pojo).

@JsonIgnoreProperties(ignoreUnknown = true)
public class PojoClass implements Serializable
{
  private String myString ...
}
John B
  • 66
  • 4