Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Hi all,
I want to convert JSON file (have url) into infotable, so I:
1.Found snippets have GetJSON function, so i edit the scripts:
var params = {
// headers: undefined,//"{'data'}" /* JSON */,
ignoreSSLErrors: true /* BOOLEAN */,
useProxy: undefined /* BOOLEAN */,
proxyHost: undefined /* STRING */,
url:"http://localhost:8080/test" /* STRING */,
timeout: 500 /* NUMBER */,
proxyPort: 8080 /* INTEGER */,
password: "MyPassword" /* STRING */,
username: "MyUsername" /* STRING */
};
// result: JSON
var result = Resources["ContentLoaderFunctions"].GetJSON(params);
2. Created the DataShape based on the Key of JSON file.
3. After I save the script and test, cannot get the infotable.
Anyone can show the detailed steps to convert from JSON file to infotable? Thanks!
usually you would iterate through the json
use create infotable from datashape
and use create infotable entry from datashape
plus yourinfotable.AddRow(rowObject)
Hi Pai Chung,
Thanks for your reply.
I found the content that directly get from the url is a bit different from the result of GetJSON function. So I changed my AddRow function from ({Name:json.name })to ({Name:data.rows.name}, and then got the correct Infotable, thanks again.
XiaoYing