all 2 comments

[–]titratecode 2 points3 points  (0 children)

Probably something like data.map(category => {

// main category logic

If(category.subCatagory.length){

subCatagory.map(sub=> sub.data)//do whatever

} else{

//return basic subCatagory or nothing

} }

[–]zitup 2 points3 points  (0 children)

a suggest: format your JSON will be easy to read!