cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

I have the url that contains JSON file data, hope to convert into infotable

Highlighted
Level 1

I have the url that contains JSON file data, hope to convert into infotable

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!

Tags (2)
2 REPLIES 2

Re: I have the url that contains JSON file data, hope to convert into infotable

usually you would iterate through the json

use create infotable from datashape

and use create infotable entry from datashape

plus yourinfotable.AddRow(rowObject)

Re: I have the url that contains JSON file data, hope to convert into infotable

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