title: Create JSON tree based on child API call in JavaScript or AngularJS
body: <p>I would be known only parent label. Based on the parent label I will call a child if the child exists for that label. I want to push that child to that parent.</p>
  
  <p>For example, parent</p>
  
  <pre><code>[
        {
          "label": "1",
          "id": "role1",
          "children": []
        }
  ]
  </code></pre>
  
  <p>Finally, I want this kind of JSON:</p>
  
  <pre><code>[
        {
          "label": "1",
          "id": "role1",
          "children": [
            {
              "label": "2",
              "id": "role11",
              "children": [
                {
                  "label": "3",
                  "id": "role111",
                  "children": []
                }
              ]
            },
            {
              "label": "4",
              "id": "role12",
              "children": [
                {
                  "label": "5",
                  "id": "role121",
                  "children": [
                      "label": "5",
                      "id": "role1211",
                  ]
                }
              ]
            },
            {
              "label": "6",
              "id": "role12",
              "children": [
                {
                  "label": "7",
                  "id": "role121",
                  "children": []
                }
              ]
            }
          ]
        }
      ]
  </code></pre>