Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to ignore unknown properties while parsing JSON in Java - Jackson @JsonIgnoreProperties Annotation Example

One of the common problem while parsing Json in Java using Jackson API is that it fails when your JSON contains unknown properties i.e. your Java class doesn't have all the field corresponding to all JSON properties. For example, if you are consuming JSON from a REST Web Service and tomorrow they added a new field into JSON then your code will break because Jackson will throw UnrecognizedPropertyException and stop parsing JSON. This is troublesome and can cause problems in production if you are not aware. I  have faced this issue when a developer shipped the code to consume data from REST API without proper handling unknown fields.
Read more »


This post first appeared on Javarevisited: Blog About Java Programmin, please read the originial post: here

Share the post

How to ignore unknown properties while parsing JSON in Java - Jackson @JsonIgnoreProperties Annotation Example

×

Subscribe to Javarevisited: Blog About Java Programmin

Get updates delivered right to your inbox!

Thank you for your subscription

×