Get size of JSON array in AngularJS
angularjs, javascript, json
Solution
You don't need Angular to get the length of that.
In this case, your parsed JSON is a simple array, you can get the length with:
obj.length
assuming that `obj` contains your parsed JSON as such:
var obj = [{"id":1,"Name":"Apple"},
{"id":2,"Name":"Mango"},
{"id":3,"Name":"Banana"}
{"id":4,"Name":"Coconut"}
{"id":5,"Name":"pineaple"}
{"id":6,"Name":"Orange"}
{"id":7,"Name":"Guava"}]
Problem
I am using AngularJS to render html page doing ajax call, which returns json file. How to get count of id's in below JSON using angularjs? ``` [{"id":1,"Name":"Apple"}, {"id":2,"Name":"Mango"}, {"id":3,"Name":"Banana"} {"id":4,"Name":"Coconut"} {"id":5,"Name":"pineaple"} {"id":6,"Name":"Orange"} {"id":7,"Name":"Guava"}] ```