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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

How to Create data shape and Infotable of given JSON type

RN_8282441
1-Newbie

How to Create data shape and Infotable of given JSON type

"EmployeeDetails": [

        {

            "EmpID ": "101",

            "status": "Active",

         

            "mobiles": [

                "9554781498",

                "9554789555"

            ],

            "Address": [

                "Address1",

                "Address2"

            ]

        },

{

            "EmpID ": "102",

            "status": "Active",

         

            "mobiles": [

                "9954781478",

                "9854789535"

            ],

            "Address": [

                "Address4",

                "Address5"

            ]

        }]

6 REPLIES 6
supandey
19-Tanzanite
(To:RN_8282441)

Hi Raj, have you already checked the available extension for this Parsely Advanced Parsing Extension available on ThingWorx Marketplace. It essentially parses the JSON (and some other formats) to Infotable.

Actually i have to build an extension(In Java) having services which return type should be infotable, But I have Json of above type, now please tell me how do i  create datashape of given JSON so that i can create Infotable and return from Extension - service.

PaiChung
22-Sapphire I
(To:RN_8282441)

Since Thingworx can 'natively' work with JSON why do you need to build the conversion into your extension? You can do it with a Service leveraging the fact that the JSON will be treated as an object.

My Requirement is to display service output on the grid, And grid can only be configured with Infotable.

Is there any way to directly map jsonObject to grid?

do you mean by

String json_string = EntityUtils.toString(httpResponse.getEntity());

infoTable.fromJSON(new JSONObject(json_string));

PaiChung
22-Sapphire I
(To:RN_8282441)

Does this have to be in a Resource?

Just a service in a Thing should do.

use the createinfotablefromdatashape to create an empty table

then step through the json object

create row objects and then add those to the empty table.

supandey
19-Tanzanite
(To:RN_8282441)

Just to add to what Pai already noted, it appears like this has been already discussed under separate thread Converting JSON into Infotable

Top Tags