Jackson objectMapper readValue

时间:2016-07-01 07:34:15

标签: jackson objectmapper

使用Jackson ObjectMapper.readValue()将JSON字符串读入java对象。

特定的java类没有默认构造函数,也无法编辑,即无法添加注释@JSONCreator@JSONProperty。 因此获得异常no suitable constructor found for type

如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

您可以使用Jackson's mixin feature向类外部添加注释。 有关详细信息,请参阅This question and its answers