console.log(result.data[0]);
returns:
{ name: 'page_stories',
period: 'day',
values:
[ { value: 114, end_time: '2016-07-31T07:00:00+0000' },
{ value: 68, end_time: '2016-08-01T07:00:00+0000' },
{ value: 134, end_time: '2016-08-02T07:00:00+0000' } ],
title: 'Daily Page Stories',
description: 'Daily: The number of stories created about your Page. (Total Count)',
id: '462582393917692/insights/page_stories/day' }
but for some reason var name = result.data[0].name;
is returning:
TypeError: Cannot read property 'name' of undefined
I can't for the life of me figure out why. the 'name' property clearly exists as does the result.data[0] object. Any help would be fantastic.
edit: found out that the data format wasn't uniform for every single request (just most!). Thanks for the responses. I should've made it clear that I was feeding batch requests through this code too.
JSON.parse(result.data[0]);
?