How to access an array in a JSON object?
That's because your base object is an array as well.
console.log(dataJS[0].comments[0]);
I suspect that would work
the JSON you have coming back is actually an array itself, so...
dataJS[0].comments[0].created_at
will be 2011-02-09T14:42:42-08:00
, etc...
Both dataJS
and comments
are arrays, and need indexes to access the appropriate elements.
console.log(dataJS);
console.log(dataJS[0].eee1);
console.log(dataJS[0].comments[0]);
The object being returned is itself an array, so to get to the first comment (as an example), this is how you would access it:
dataJS[0].comments[0]