javascript - Working with JSON response from jQuery (Coffeescript) -


i'm trying data json http request. i'm returned 10 objects each contain several keys. can access specific object can't key.

this code me object in console , can see each key , value.

  $.getjson(flurryapi, format: "json" ).done (data) ->   console.log data.event[0] 

how access specific key? e.g. id

this see in console above code:

object {@userslastweek: "0", @userslastmonth: "0", @userslastday: "0", @totalsessions: "10", @totalcount: "10"…} 

if data.event[0] object properties then:

console.log( data.event[0]['@totalcount'] ); console.log( data.event[0]['@userslastweek'] ); 

because of @ in property names, have use array notation [] instead of object . notation.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -