Can jackson parser Object from json if I add or delete some field? -
in work, want use jackson in situation:
{ "student": { "name" : "hello", "id" : "stu_001" } } then, define class student:
class student { public string name; public string id; //get , set methods } but, in case, json be:
{ "student": { "name" : "hello", "id" : "stu_001", "age" : "23" } } or:
{ "student": { "name" : "hello" } } all in all, want use jackson parser students data, when json add or delete filed, how can solve jackson?
thank you~
oops!
i search google, , find answer!
use following code:
```objectmapper.configure(org.codehaus.jackson.map.deserializationconfig.feature.fail_on_unknown_properties, false);``` when add field original don't have, ignore field.when delete field, assign field "null".
Comments
Post a Comment