Skip to content Skip to sidebar Skip to footer

Object To Array - Quick Conversion

I have a Json structure of this kind: this is generate from the backend (I'm using Firebase) and put in a variable : var newJson = {} I'm using AngularJS and ng-repeat though thi

Solution 1:

try this

var arreyM = [];
 for (var i = 0; i < $scope.newJson.length; i++) {
      arreyM[i]['name']= $scope.newJson[i].name;
      arreyM[i]['pic']= $scope.newJson[i].pic
      arreyM[i]['pic'] =  $scope.newJson[i].vote; 
 }

Hope it will help

Post a Comment for "Object To Array - Quick Conversion"