JSON to InfoTable
Hello, I followed various articles from community forum here as well as this TWX article. and I am still having issues with my code outputting to an InfoTable. I am using an API to fetch Stock Price JSON data and having it be converted to an InfoTable, so it can be displayed into a graph in Mashups.
I've attached screenshots of my DataShape Field Definitions as well as the JSON Data Output.
The TWX code, with it outputting the columns with "No Data" is below. I've tried playing around with the for loop and doing a data.array.length but that mentions length is undefined. I am not sure if that would output to it being an InfoTable either. Thank you.
var restParams = {
proxyScheme: undefined /* STRING */,
headers: undefined /* JSON */,
ignoreSSLErrors: true /* BOOLEAN */,
useNTLM: undefined /* BOOLEAN */,
workstation: undefined /* STRING */,
useProxy: undefined /* BOOLEAN */,
withCookies: undefined /* BOOLEAN */,
proxyHost: undefined /* STRING */,
url: "https://finnhub.io/api/v1/quote?symbol=AAPL&token=c1mbi3i37fkpnsp59e6g" /* STRING */,
content: undefined /* JSON */,
timeout: undefined /* NUMBER */,
proxyPort: undefined /* INTEGER */,
password: undefined /* STRING */,
domain: undefined /* STRING */,
username: undefined /* STRING */
};
// result: JSON
var data = Resources["ContentLoaderFunctions"].GetJSON(restParams);
var params = {
infoTableName: "InfoTable" /* STRING */,
dataShapeName: "GrahicVisualizer_Stock_DS" /* DATASHAPENAME */
};
// result: INFOTABLE
var jsonTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);
//var tableLength = CobotInfoTable.rows.length;
//fix code below
for(var i=0;i<data.length;i++)
{
jsonTable.AddRow({
c:data.c,
h:data.h,
l:data.l,
o:data.o,
pc:data.pc,
t:data.t
});
}
result = jsonTable;



