How should I create algorithm on creation of following JSON pattern using Java ?
Target JSON pattern is as follows
{
"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",
}]
}]
}]
}
From following table
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
I am adding 1 object 1 row to ArrayList<Object>
ArrayList->JSon?