我在javascript中有一个字符串变量,如下所示:
var tree='[{"id":1},{"id":2,"children":[{"id":3},{"id":4},{"id":5,"children"[{"id":6}]}]';
now i want to create a tree from this in which
# 1 and 2 will at same level
# 3 ,4 ,5 will be the sub nodes of 2.
# 6 will be the sub node of 5.
请帮助通过 javascript 或 jquery 制作一个树形这个树变量。多变的。