title: How to add JSON object into JSON array using angular JS?
body: <p>I have problem while parsing single json object.</p>
  
  <p>Assume that the below data get from server</p>
  
  <pre><code>        {
              "root": {
                  "data": [
                      {
                          "name": "Raj",
                          "age": "22"
                      },
                      {
                          "name": "Janu",
                          "age": "22"
                      }
                  ]
              }
          }
  </code></pre>
  
  <p>And my script is</p>
  
  <p>Script.js</p>
  
  <pre><code>        var myApp=angular.module('myApp',[]);
          myApp.controller('myCtrl', function($scope, $http){
             $http.get("manydata.json")
              .success(function(response) {
                $scope.myDatas = response.root;
              });
          });
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>    &lt;div ng-repeat="i in myDatas.data"&gt;
  
            Name: {{i.name}}
            Age: {{i.age}}
  
       &lt;/div&gt;
  </code></pre>
  
  <p>I have no problem while the response data is more than 1. But If the response data is 1 then the json will be:</p>
  
  <pre><code>    {
        "root": {
          "data": {
            "name": "Raj",
            "age": "22"
          }
        }
      }
  </code></pre>
  
  <p>How to generically parse these json data ? </p>
  
  <p>PLNKR: <a href="http://plnkr.co/edit/W4YK6BDtIBfVhnPpHVm1?p=preview" rel="nofollow">http://plnkr.co/edit/W4YK6BDtIBfVhnPpHVm1?p=preview</a></p>