lets say I have an array of strings which represents a package-structure. It looks like this:
Array {
"com.project.server",
"com.project.client",
"com.project.client.util",
...
}
Its not defined how many levels one package can contain.
Now I want to convert this into an hierarchical JSON-Object. This should look like this:
{
"name": "com",
"children": [
{
"name": "project",
"children": [
{
"name": "server"
},
{
"name": "client",
"children": [
{
"name": "util"
}
]
}
]
}
]
}
I hope you can understand what I want.
To be honest, I am hopelessly questioned...
Can you help me? Thanks and sorry for possible bad english.