For example, I'd like to parse the following array:
var array1 = ["a.b.c.d", "a.e.f.g", "a.h", "a.i.j", "a.b.k"]
into:
var json1 = {
"node": "a",
"leaf": false,
"children": [{
"node": "b",
"leaf": false,
"children": [{
"node": "c",
"children": [{
"node": "d",
"leaf": true,
"children": []
}]
},
{
"node": "h",
"leaf": true,
"children": []
}
]
},
{
"node": "e",
"leaf": false,
"children": [{
"node": "f",
"leaf": true,
"children": []
}]
},
{
"node": "g",
"leaf": true,
"children": []
}
]
}
I think that D3.JS provides a good way to do this but I cannot find some good example.
Thanks for any help!