我应该如何在使用 Java 创建以下 JSON 模式时创建算法?
目标JSON模式如下
{
"title":"ABC",
"children":[{
"title":"ABC_SUK",
"children":[{
"title":"ABC_SUK_Block_01",
"children":[{
"title":"XXX_201",
},{
"title":"XXX_202",
}]
},{
"title":"ABC_SUK_Block_02",
"children":[{
"title":"XXX_203",
},{
"title":"XXX_204",
}]
}]
}]
}
从下表
group | site | block |hostname
_________________________________________
ABC | ABC_suk | ABC_SUK_Block_01|XXX_201
ABC | ABC_suk | ABC_SUK_Block_01|XXX_202
ABC | ABC_suk | ABC_SUK_Block_02|XXX_203
ABC | ABC_suk | ABC_SUK_Block_02|XXX_204
我要添加 1 个对象 1 行ArrayList<Object>