I am getting an error while trying to deserialize json in an abstract type.
Code:
@JsonTypeInfo (use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@ Class ") Public abstract class animal {} public square dog expansion animal {} Public square zoo (animal a;) @RequestMapping (value =" / zoos ", method = RequestMethod.POST) Generate Public Zero (@RequestBody Zoo) { ...} When I post the following zson in zoos:
{"@class": "com.example.Dog", "A": {}} I get an error: org. Codehaus.jackson.map.exc.UnrecognizedPropertyExcept Ion: Unrecognized area "@ class" (class com.example.Zoo), which is not unknowingly marked
What am I doing wrong?
Okay, I'm stupid:
must be json:
{"A" : {"@class": "com.example.Dog"}} Because @ class belongs to the type of animal.
No comments:
Post a Comment