Here is my json example, I get my json obj from firebase. I need to convert a list to an array in order to bind it in html trough ng-repeat.
my json object
{ "cats1": { "Name": "cricket", "imgUrl": "some url", "list1": { "bat": { "Name": "bat", "imgUrl": "some url", "price": "$100" }, "pads": { "displayName": "pads", "imgUrl": "some url", "price": "$50" } } }, "cats2": { "Name": "football", "imgUrl": "some url" } }
this is how i demanded
this is the array structure that I need when I add a new list, which it should store uniquely in the cricket category.
[ { "Name": "cricket", "imgUrl": "some url", "list1": [ { "Name": "bat", "imgUrl": "some url", "price": "$100" }, { "displayName": "pads", "imgUrl": "some url", "price": "$50" } ] }, { "Name": "football", "imgUrl": "some url" } ]
I'm new to angular, someone please help me sort this out.
json javascript arrays angularjs
Sukumar ms
source share