At present I am pulling my folder structure data as mentioned below.
{
{
"parent": "TestParent1"
"Child" : "TestSub1"
"GrnadChild":"TestGrandChild1"
},
{
"parent": "TestParent1"
"Child" : "TestSub1"
"GrnadChild":"TestGrandChild2"
},
{
"parent": "TestParent1"
"Child" : "TestSub2"
"GrnadChild":"TestGrandChild3"
},
{
"parent": "TestParent1"
"Child" : "TestSub2"
"GrnadChild":"TestGrandChild4"
}
}
I have a parent folder that consists 2 sub folder and each sub folder consists 2 grand folders. I need the data to be framed in below json format.
{
"parent": "TestParent1",
{
"Child" : "TestSub1"
{
"GrnadChild" :
{
"TestGrandChild1",
"TestGrandChild2"
}
},
"Child" : "TestSub2"
{
"GrnadChild" :
{
"TestGrandChild3",
"TestGrandChild4"
}
}
},
"parent": "TestParent2",
{
"Child" : "TestSub3"
{
"GrnadChild" :
{
"TestGrandChild5",
"TestGrandChild6"
}
},
"Child" : "TestSub4"
{
"GrnadChild" :
{
"TestGrandChild7",
"TestGrandChild8"
}
}
}
}
Kindly assist me to wirte the java logic and Appreciate your help.