I am getting an error while trying to deserialize json in an abstract type.
Code: When I post the following zson in zoos: 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: Because @ class belongs to the type of animal.
@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) { ...}
{"@class": "com.example.Dog", "A": {}}
{"A" : {"@class": "com.example.Dog"}}
No comments:
Post a Comment