How to find count of children of root nodes json data in angularjs -


i have following array of json data. there 2 root nodes , there subnodes of root nodes , sub-nodes of sub-nodes. need find how many subnodes root node has. have no idea how that.

[ {     "id": "0",     "name": "subscriber"     "suscribers": [         {             "id": "0",             "name": "suscriber 1"             "events": [                 {                     "id": "0",                     "name": "subscriber"                     "suscribers": [                         {                             "id": "0",                             "name": "suscriber 1"                          },                         {                             "id": "1",                             "name": "suscriber 1"                          }                     ],                     "actions": [                         {                             "name": "start",                             "text": "abc"                         },                         {                             "name": "start",                             "text": "abc"                         }                     ]                 },                 {                     "id": "1",                     "name": "subscriber"                     "suscribers": [                         {                             "id": "0",                             "name": "suscriber 1"                         },                         {                             "id": "1",                             "name": "suscriber 1"                         }                     ],                     "actions": [                         {                             "name": "start",                             "text": "abc"                         },                         {                             "name": "start",                             "text": "abc"                         }                     ]                 }             ],             "actions": null         },         {             "id": "1",             "name": "suscriber 1"             "events": [                 {                     "id": "0",                     "name": "subscriber"                     "suscribers": [                         {                             "id": "0",                             "name": "suscriber 1"                         },                         {                             "id": "1",                             "name": "suscriber 1"                           }                     ],                     "actions": [                         {                             "name": "start",                             "text": "abc"                         },                         {                             "name": "start",                             "text": "abc"                         }                     ]                 },                 {                     "id": "1",                     "name": "subscriber"                     "suscribers": [                         {                             "id": "0",                             "name": "suscriber 1"                         },                         {                             "id": "1",                             "name": "suscriber 1"                         }                     ],                     "actions": [                         {                             "name": "start",                             "text": "abc"                         },                         {                             "name": "start",                             "text": "abc"                         }                     ]                 }             ],             "actions": null         }     ],     "actions": [         {             "name": "start",             "text": "abc"         },         {             "name": "start",             "text": "abc"         }     ] }, {     "id": "1",     "name": "subscriber"     "suscribers": [         {             "id": "0",             "name": "suscriber 1"             "events": [                 {                     "id": "0",                     "name": "subscriber"                     "suscribers": [                         {                             "id": "0",                             "name": "suscriber 1"                         },                         {                             "id": "1",                             "name": "suscriber 1"                         }                     ],                     "actions": [                         {                             "name": "start",                             "text": "abc"                         },                         {                             "name": "start",                             "text": "abc"                         }                     ]                 },                 {                     "id": "1",                     "name": "subscriber"                     "suscribers": [                         {                             "id": "0",                             "name": "suscriber 1"                         },                         {                             "id": "1",                             "name": "suscriber 1"                         }                     ],                     "actions": [                         {                             "name": "start",                             "text": "abc"                         },                         {                             "name": "start",                             "text": "abc"                         }                     ]                 }             ],             "actions": null         },         {             "id": "1",             "name": "suscriber 1"              ,               "events": [                 {                     "id": "0",                     "name": "subscriber"                         "suscribers": [                         {                             "id": "0",                             "name": "suscriber 1"                           },                         {                             "id": "1",                             "name": "suscriber 1"                           }                     ],                     "actions": [                         {                             "name": "start",                             "text": "abc"                         },                         {                             "name": "start",                             "text": "abc"                         }                     ]                 },                 {                     "id": "1",                     "name": "subscriber                     "suscribers": [                         {                             "id": "0",                             "name": "suscriber 1"                         },                         {                             "id": "1",                             "name": "suscriber 1"                           }                     ],                     "actions": [                         {                             "name": "start",                             "text": "abc"                         },                         {                             "name": "start",                             "text": "abc"                         }                     ]                 }             ],             "actions": null         }     ],     "actions": [         {             "name": "start",             "text": "abc"         },         {             "name": "start",             "text": "abc"         }     ] } ] 


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -