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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

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

xcheung
1-Newbie

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!

2 REPLIES 2
PaiChung
22-Sapphire I
(To:xcheung)

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

Top Tags