Does anyone have a solution for converting an array of URL-like data into JSON format?
For example, how can we convert the array
["a.b.c.d", "a.c.e.f", "a.b.c.g"]
into the following JSON structure:
items:{
text: "a",
items:[
{
text:"b",
items:[
{
text:"c",
items:[
{
text:"d",
leaf:true
},
{
text:"g",
leaf:true
}
]
}
]
},
{
text:"c",
items:[
{
text:"e",
items:[
{
text:"f",
leaf:true
}
]
}
]
}
]
}