a = {
id:1,
name:"sd",
children:[
{id:2,name:"gg",children:[
{id:"4",name:"hh"},
{id:"5",name:"jj"}
]},
{id:3,name:"ff",children:[
{id:"6",name:"tt"},
{id:"7",name:"yy"}
]}
]
}
a对象有时children为null,有时只有一层children
获取对象里面所有的id
常规操作就是递归遍历,下面说个利用JSON.stringify的特性的