JavaScript JSON multilevel iterative parsing
<pre><code>{
   "id":0,
   "item":[
      {
         "id":"0-",
         "text":"BlueWing",
         "userdata":[
            {
               "name":"cid",
               "content":"10377"
            }
         ],
         "item":[
            {
               "id":"0-0",
               "text":"Auto",
               "userdata":[
                  {
                     "name":"cid",
                     "content":"10377,10376,10378,10387,10379,10384,10386,10380,10383,10385,10381,10388,10533"
                  }
               ],
               "item":[
                  {
                     "id":"0-0-0",
                     "text":"Auto",
                     "userdata":[
                        {
                           "name":"cid",
                           "content":"10377,10376,10378,10387,10379,10384,10386,10380,10383,10385,10381,10388"
                        }
                     ],
                     "item":[
                        {
                           "id":"0-0-0-0",
                           "text":"testaccount",
                           "userdata":[
                              {
                                 "name":"cid",
                                 "content":"10377,10376,10378,10387,10379,10384,10386,10380,10383,10385,10381,10388"
                              }
                           ],
                           "item":[
                              {
                                 "id":"0-0-0-0-0",
                                 "text":"Add New List",
                                 "userdata":[
                                    {
                                       "name":"clid",
                                       "content":99999
                                    },
                                    {
                                       "name":"cid",
                                       "content":"10377,10376,10378,10387,10379,10384,10386,10380,10383,10385,10381,10388"
                                    }
                                 ]
                              },
                              {
                                 "id":"0-0-0-0-1",
                                 "text":"testaccount",
                                 "userdata":[
                                    {
                                       "name":"cid",
                                       "content":"10377,10376,10378,10387,10379,10384,10386,10380,10383,10385,10381,10388"
                                    }
                                 ],
                                 "item":[
                                    {
                                       "id":"0-0-0-0-1-0",
                                       "text":"Add New List",
                                       "userdata":[
                                          {
                                             "name":"clid",
                                             "content":99999
                                          },
                                          {
                                             "name":"cid",
                                             "content":"10377,10376,10378,10387,10379,10384,10386,10380,10383,10385,10381,10388"
                                          }
                                       ]
                                    },
                                    {
                                       "id":"0-0-0-0-1-1",
                                       "text":"testaccount - 10377,10376,10378,10387,10379,10384,10386,10380,10383,10385,10381,10388",
                                       "userdata":[
                                          {
                                             "name":"cid",
                                             "content":"10377,10376,10378,10387,10379,10384,10386,10380,10383,10385,10381,10388"
                                          }
                                       ],
                                       "item":[
                                          {
                                             "id":"0-0-0-0-1-1-0",
                                             "text":"Add New List",
                                             "userdata":[
                                                {
                                                   "name":"clid",
                                                   "content":99999
                                                },
                                                {
                                                   "name":"cid",
                                                   "content":"10377,10376,10378,10387,10379,10384,10386,10380,10383,10385,10381,10388"
                                                }
                                             ]
                                          }
                                       ]
                                    }
                                 ]
                              }
                           ]
                        }
                     ]
                  },
                  {
                     "id":"0-0-1",
                     "text":"Balise Toyota",
                     "userdata":[
                        {
                           "name":"cid",
                           "content":"10533"
                        }
                     ],
                     "item":[
                        {
                           "id":"0-0-1-0",
                           "text":"Balise Toyota",
                           "userdata":[
                              {
                                 "name":"cid",
                                 "content":"10533"
                              }
                           ],
                           "item":[
                              {
                                 "id":"0-0-1-0-0",
                                 "text":"Add New List",
                                 "userdata":[
                                    {
                                       "name":"clid",
                                       "content":99999
                                    },
                                    {
                                       "name":"cid",
                                       "content":"10533"
                                    }
                                 ]
                              },
                              {
                                 "id":"0-0-1-0-1",
                                 "text":"Balise Toyota",
                                 "userdata":[
                                    {
                                       "name":"cid",
                                       "content":"10533"
                                    }
                                 ],
                                 "item":[
                                    {
                                       "id":"0-0-1-0-1-0",
                                       "text":"Add New List",
                                       "userdata":[
                                          {
                                             "name":"clid",
                                             "content":99999
                                          },
                                          {
                                             "name":"cid",
                                             "content":"10533"
                                          }
                                       ]
                                    },
                                    {
                                       "id":"0-0-1-0-1-1",
                                       "text":"Balise Toyota - 10533",
                                       "userdata":[
                                          {
                                             "name":"cid",
                                             "content":"10533"
                                          }
                                       ],
                                       "item":[
                                          {
                                             "id":"0-0-1-0-1-1-0",
                                             "text":"Add New List",
                                             "userdata":[
                                                {
                                                   "name":"clid",
                                                   "content":99999
                                                },
                                                {
                                                   "name":"cid",
                                                   "content":"10533"
                                                }
                                             ]
                                          },
                                          {
                                             "id":"0-0-1-0-1-1-1",
                                             "text":"Balise.List - 11949",
                                             "userdata":[
                                                {
                                                   "name":"clid",
                                                   "content":11949
                                                },
                                                {
                                                   "name":"cid",
                                                   "content":"10533"
                                                }
                                             ]
                                          }
                                       ]
                                    }
                                 ]
                              }
                           ]
                        }
                     ]
                  }
               ]
            },
            {
               "id":"0-1",
               "text":"BlueWing",
               "userdata":[
                  {
                     "name":"cid",
                     "content":"10667,10668"
                  }
               ],
               "item":[
                  {
                     "id":"0-1-0",
                     "text":"HVAC",
                     "userdata":[
                        {
                           "name":"cid",
                           "content":"10667,10668,10348,10294,10297,10313,10521,10351,10309,10296,10316,10315,10312,10301,10347,10300,10306,10308,10307,10298,10305,10371,10291,10349,10311,10354,10345,10310,10292,10372,10295,10304,10303,10299,10314,10290,10490,10293,10302"
                        }
                     ],
                     "item":[
                        {
                           "id":"0-1-0-0",
                           "text":"HVAC",
                           "userdata":[
                              {
                                 "name":"cid",
                                 "content":"10667,10668"
                              }
                           ],
                           "item":[
                              {
                                 "id":"0-1-0-0-0",
                                 "text":"Add New List",
                                 "userdata":[
                                    {
                                       "name":"clid",
                                       "content":99999
                                    },
                                    {
                                       "name":"cid",
                                       "content":"10667,10668"
                                    }
                                 ]
                              },
                              {
                                 "id":"0-1-0-0-1",
                                 "text":"Mann Plumbing &amp; Heating",
                                 "userdata":[
                                    {
                                       "name":"cid",
                                       "content":"10667"
                                    }
                                 ],
                                 "item":[
                                    {
                                       "id":"0-1-0-0-1-0",
                                       "text":"Add New List",
                                       "userdata":[
                                          {
                                             "name":"clid",
                                             "content":99999
                                          },
                                          {
                                             "name":"cid",
                                             "content":"10667"
                                          }
                                       ]
                                    },
                                    {
                                       "id":"0-1-0-0-1-1",
                                       "text":"Mann Plumbing &amp; Heating - 10667",
                                       "userdata":[
                                          {
                                             "name":"cid",
                                             "content":"10667"
                                          }
                                       ],
                                       "item":[
                                          {
                                             "id":"0-1-0-0-1-1-0",
                                             "text":"Add New List",
                                             "userdata":[
                                                {
                                                   "name":"clid",
                                                   "content":99999
                                                },
                                                {
                                                   "name":"cid",
                                                   "content":"10667"
                                                }
                                             ]
                                          },
                                          {
                                             "id":"0-1-0-0-1-1-1",
                                             "text":"Radius List - 12960",
                                             "userdata":[
                                                {
                                                   "name":"clid",
                                                   "content":12960
                                                },
                                                {
                                                   "name":"cid",
                                                   "content":"10667"
                                                }
                                             ]
                                          }
                                       ]
                                    }
                                 ]
                              },
                              {
                                 "id":"0-1-0-0-2",
                                 "text":"RES Air Conditioning",
                                 "userdata":[
                                    {
                                       "name":"cid",
                                       "content":"10668"
                                    }
                                 ],
                                 "item":[
                                    {
                                       "id":"0-1-0-0-2-0",
                                       "text":"Add New List",
                                       "userdata":[
                                          {
                                             "name":"clid",
                                             "content":99999
                                          },
                                          {
                                             "name":"cid",
                                             "content":"10668"
                                          }
                                       ]
                                    },
                                    {
                                       "id":"0-1-0-0-2-1",
                                       "text":"RES Air Conditioning - 10668",
                                       "userdata":[
                                          {
                                             "name":"cid",
                                             "content":"10668"
                                          }
                                       ],
                                       "item":[
                                          {
                                             "id":"0-1-0-0-2-1-0",
                                             "text":"Add New List",
                                             "userdata":[
                                                {
                                                   "name":"clid",
                                                   "content":99999
                                                },
                                                {
                                                   "name":"cid",
                                                   "content":"10668"
                                                }
                                             ]
                                          }
                                       ]
                                    }
                                 ]
                              }
                           ]
                        }
                     ]
                  }
               ]
            }
         ]
      }
   ]
}
</code></pre>

<p>I need to iterate through all levels and match by "id" and get the value for "content".</p>

<pre><code>var id = "0-1-0-0-0";
</code></pre>

<p>If <code>id</code> of JSON matches id then return the value for <code>content</code>.
Should return <code>10667,10668</code></p>

<p>Thanks in advance!</p>