1
Good, I have a json that I wanted to iterate but within it there is another that I also wanted to iterate
var json = {
"categories":[
{
"id":1,
"name":"Best Seller",
"childs":[
{
"name":"Novidades",
"id":2,
"parentID":1,
"productCount":1
},
{
"name":"quatro",
"id":7,
"parentID":1,
"productCount":0
}
]
},
{
"id":2,
"name":"Novidades",
"childs":[
{
"name":"tres",
"id":6,
"parentID":2,
"productCount":0
}
]
},
{
"id":6,
"name":"tres",
"childs":[
]
},
{
"id":7,
"name":"quatro",
"childs":[
]
},
{
"id":8,
"name":"cinco",
"childs":[
{
"name":"seis",
"id":9,
"parentID":8,
"productCount":0
}
]
},
{
"id":9,
"name":"seis",
"childs":[
]
}
],
"productTypes":[
{
"key":0,
"value":"Undefined"
},
{
"key":1,
"value":"Book"
}
]
}
How could I push Childs into another array knowing that childs.length > 0
?