Let's assume I have this input
0 //1st zero
1 //is child of 1st zero
0 //2nd zero
1 //is child of 2nd zero
1 //is child of 2nd zero
2 //is child of 2nd one
2 //is child of 2nd one
1 //etc...
2
3
2
1
0
and this class
public class Node
{
public int Number { get; set; }
public Node Parent { get; set; }
public List<Node> Children { get; set; }
}
What is the best way to parse this output and then serialize it to json?
What I really need is the algorithm to traverse this input and make a multi-leaf tree structure so I could serialize to json and then pass it to d3js javascript library which will visualize this tree.