如何使用 java 对象和 Jackson 递归地创建这个 json 内容?:
{
"children": [
{
"children": [
{
"name": "cluster",
"children": [
{
"name": "AgglomerativeCluster",
"size": 3938
},
{
"name": "TestCLuster",
"size": 3938
}
]
}
],
"name": "analytics"
}
],
"name": "flare"
}
到目前为止,这是我的对象结构,一个名为 DendogramVO 的父类和一个名为 Children 的子类,它也有一个子类 List :
import java.util.List;
public class DendogramVO {
private List<Children> children;
private String name;
public List<Children> getChildren() {
return this.children;
}
public void setChildren(List<Children> children) {
this.children = children;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
}
import java.util.List;
public class Children {
private List<Children> children;
private String name;
public List<Children> getChildren() {
return children;
}
public void setChildren(List<Children> children) {
this.children = children;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}