How can I find out the total children count of each root node P in my JSON object. This is not a DOM structure. Considering P2 's children also children of P1 as P2 is child of P1.
P1-|-C1 (P1 children count 3)
|-C2
|-P2-|-C1 (P2 children count 5)
|-C2
|-P3-|-C1 (P3 children count 2)
|-C2
|-C3
|-C4
|-P4-|-C1 (P4 children count 2)
|-C2
Thanks in advance.
first level children. See my answer below