Don Nijssen Don Nijssen - 1 month ago 4x
JSON Question

Ionic app reading service object

How can i get the value of "name" in this json string? i tried a lot but it always returns a undefined object back so it means i am doing somthing wrong with the order of values i call.

Thansk for you help in advance.

console gives my this if i JSON.stringify my object

{"data":{"Events":[{"festival_id":"2","name":"Pinkpop","date":"2017-06-03","genre":"Pop/Rock","longitude":"6.0224085","latitude":"50.8927646"}]},"status":200,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"","headers":{"Accept":"application/json, text/plain, /"}},"statusText":"OK"}


I check your JSON response for accessing name attribute from event array you need to use following way

For Example


Because Events is array object otherwise if you need to use ng-repeat and use like following way

 <div ng-repeat="event in events">
   <div class="name">{{}}</div>

In controller you need to add following code

    $ = data.Events;

Hopes this will help you !!