我试图摆弄ObjectMapper的属性来实现以下目标,但是到现在为止找到了一个方法
Context : We've following classes
class X {
:
}
class C {
private String c1;
private String c2;
private List<X> c3;
}
Input : A String that represents JSONArray. Ex : "[ {..}, {..} ]"
Output : Java Class 'C' with c1, c2 set as null and c3 set from input
我不想先将输入转换为JSON字符串,然后自己创建C实例,然后手动设置c3。我可以如上所述反序列化输入json字符串