Java Jackson org.codehaus.jackson.map.exc.UnrecognizedPropertyException
•
Android
I'm using Jackson to bind the JSON response to my class. Everything is fine unless there are more fields in my JSON response instead of my class definition. I hope Jackson ignores the fields that don't exist in my JSON response. This is due to the compatibility of future versions. If I add a new field, I don't want the previous version of the client to crash
Ideas?
ObjectMapper mapper = new ObjectMapper(); // can reuse, share globally
PromoResponse promoResponse = mapper.readValue(r, PromoResponse.class);
resolvent:
You can place the @ jsonignoreproperties (ignoreunknown = true) comment on the promoresponse class
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码