I have an array of strings that describe the parent/child relationship by being delimited with dashes. So, if Bob's boss was Jim and Jim's boss was Fred, Bob's entry in the array would be "Fred-Jim-Bob" and Jim's entry would be "Fred-Jim." I don't have the ability to change the way the data is coming in so I was looking for help as far as the best way of turning these values into JSON similar to this:
{
"name": "Fred",
"children": {
"name": "Jim",
"children": {
"name": "Bob"
}
}
}
Any help would be greatly appreciated. Thanks.