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
local data = http.jsondecode(res.body);
local dataS = data.datastreams;//<<<< ERROR here


foreach(s in dataS) {
    if (s.id == "T1") {
        stream1 = s;
    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;



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.


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.