我有这个豆
class Toto
{
private final String fuu;
private final String bar;
Private List<Dog> dogs;
}
class Dog {
private String name;
private String race;
}
我想将此bean转换为Map&lt;&gt;使用:
ObjectMapper serializer = new ObjectMapper();
serializer.setSerializationInclusion(JsonInclude.Include.NON_NULL);
return serializer.convertValue(entry, Map.class);
此代码结果是Dog对象也被转换为Map。
我想要一个解决方案,以便在最终地图中我会:
fuu=fuu_value_as_String
bar=bar_value_as_String
dogs=[ObjectDog1, ObjectDog2] // i do not want the Object to be
converted (because i have an instanceof check later in the code)
由于