I must get a value in a json data like in following link: Value in json data (sorry because I can't emb image). I need to get value of "DT sau CK" and I see that it's value is an empty array [ ]. My function is:
function test () {
api_url = 'https://my url....'
var result = UrlFetchApp.fetch(api_url);
var data = JSON.parse(result);
var dtt = data['chart']['data'][2]['value'];
if (dtt == false || dtt.length == 0) {
dtt = 0;
} else {
dtt = data['chart']['data'][2]['value'];
}
return Number(dtt)
}
resultto your question. The error must lie in the datastructure or how you access it.