更新时间:2021-07-11 17:19:04
如果没有为值
字段提供额外的类型信息,您将无法将数据反序列化到此对象中。这是因为 Number
类是抽象的,不能被实例化。将字段更改为 Object
将无济于事,因为该类没有可写的字段,Jackson可以反序列化数据。
You won't be able to deserialize data into this object without supplying additional type information for your value
field. This is because the Number
class is abstract and cannot be instantiated. Changing the field to Object
will not help, since there are no writable fields on that class that Jackson can deserialize data into.
您应该将字段更改为 Number
类(整数
, Long
, Double
等等)。
You should change the field to be one of the concrete implementations of the Number
class (Integer
, Long
, Double
etc).