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

JSON to Infotable

rmasoud1
1-Visitor

JSON to Infotable

Hi,

I ma trying to turn my JSON into an infotable. The JSON is being pushed to a propety of a thing in Thingworx from a java code. I am not sure how to go about this as all the questions I have seen are creating the json in the script. I want to place the table into a grid on a mashup.

Thank you

5 REPLIES 5

Links are not found!!

Hi Raj, there must be something in the community that blocked the links, sorry for that. Here I will attach the KCS number here directly, please check if they are helpful.

  • Convert JSON to an InfoTable   CS179012

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS179012&posno=1&q=Convert%20JSON%20to%20an%20InfoTable&source=…

  • Convert XML to InfoTable or DataTable   CS218242

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS218242&posno=1&q=Convert%20XML%20into%20an%20InfoTable%20or%2…

Ryan Yuan​ Thanks!!

jamesm1
12-Amethyst
(To:rmasoud1)

You might also like to try out this extension from the Marketplace which will translate JSON objects into InfoTables:

https://marketplace.thingworx.com/tools/Parsley_Extension

There is also another way you can do this purely within a JavaScript service if you have a datashape and you have an array of objects that matches that datashape. Here is how you can create a JSON representation of an InfoTable and then use the FromJSON snippet to transform it into a native InfoTable type:

//How to create an infotable from pure JSON

//create the JSON object to represent your infotable

var json = new Object();

//add the datashape definition

//this needs to be the correct datashape for your rows, in my example this is just a datahsape with a single string field called id

json.dataShape = DataShapes["DataShapeName"].GetDataShapeMetadataAsJSON();

  

//create a rows array

json.rows = [];

//add each row as an object

var row = new Object();

row.id = "idValue";

json.rows.push(row);

// result: INFOTABLE

var result = Resources["InfoTableFunctions"].FromJSON({json: json});

Announcements


Top Tags