Jsondecode from data.sparkfun.com

I am trying to create streams for HTML page on my agent for graphing using google line chart. I’m getting an error when trying to access the json data that sparkfun is returning. I get:

ERROR: the index ‘datastreams’ does not exist

`function getStreamData(feedID){

local trigger_url = "https://data.sparkfun.com/output/xxxxxxxxxxxxxxxxxx.json?page=1";

local req = http.get(trigger_url, {});     //add headers
local res = req.sendsync();         //send request
server.log(res.body);
local data = http.jsondecode(res.body);
local dataS = data.datastreams;//<<<< ERROR here

server.log(T1SafeName);

foreach(s in dataS) {
    if (s.id == "T1") {
        stream1 = s;
        server.log("stream1")
    }
    if (s.id == "T2") {
        stream2 = s;
    }
    if (s.id == "T3") {
        stream3 = s;
    }
    if (s.id == "T4") {
        stream4 = s;
    }
    if (s.id == "Board_Temp") {
        streamtb = s;
    }
    if (s.id == "Humidity") {
        streamhum = s;
    }        
}

return;

};`

I see that this code was used for an Xively account json response and that is where “datastreams” comes from.

New Question:
Once I jsondecode the table from data.sparkfun, how can I create the same stream variable as the xively example did? There is no header data in the sparkfun json.

[{"boardtemp":"68.099998","humidity":"36.799999","t1":"0.000000","t2":"48.400002","t3":"64.699997","t4":"64.900002","timestamp":"2015-10-28T17:43:18.585Z"},{"boardtemp":"68.099998","humidity":"36.900002","t1":"0.000000","t2":"48.299999","t3":"64.900002","t4":"65.099998","timestamp":"2015-10-28T17:42:49.336Z"},{"boardtemp":"67.800003","humidity":"37.000000","t1":"0.000000","t2":"48.200001","t3":"64.800003","t4":"64.900002","timestamp":"2015-10-28T17:42:18.874Z"},{"boardtemp":"68.099998","humidity":"36.900002","t1":"0.000000","t2":"48.200001","t3":"64.699997","t4":"65.199997","timestamp":"2015-10-28T17:41:47.513Z"},

All Fixed. Hope no one was bothered today :slight_smile:

Didn’t use the stream and put the json decoded data into a blob so the html response can spit it back out for the google line chart.