"EmployeeDetails": [
{
"EmpID ": "101",
"status": "Active",
"mobiles": [
"9554781498",
"9554789555"
],
"Address": [
"Address1",
"Address2"
]
},
{
"EmpID ": "102",
"status": "Active",
"mobiles": [
"9954781478",
"9854789535"
],
"Address": [
"Address4",
"Address5"
]
}]
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.
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));
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.
Just to add to what Pai already noted, it appears like this has been already discussed under separate thread Converting JSON into Infotable