I am working on a project, where the Json contract may change overtime, If they had new property to the response Json, I might get a exception when deserializing into java object, How to ignore the new properties and only deserialize elements which are present in java Object, I am using Jackson 1.9.13, Does this version have feature which could ignore the Json element?
Asked
Active
Viewed 945 times
1
-
Possible duplicates [Ignoring new fields on JSON objects using Jackson](http://stackoverflow.com/questions/5455014/ignoring-new-fields-on-json-objects-using-jackson) – Fady Saad May 04 '17 at 04:01
-
Possible duplicate of [Ignoring new fields on JSON objects using Jackson](http://stackoverflow.com/questions/5455014/ignoring-new-fields-on-json-objects-using-jackson) – Amit May 04 '17 at 04:15
1 Answers
0
You can do this in 2 ways:
Add annotation to class:
@JsonIgnoreProperties(ignoreUnknown = true) class <class_name>{ .... .... }
Configure
ObjectMapper
:objectMapper.configure(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);

Sachin Gupta
- 7,805
- 4
- 30
- 45