Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
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
Here are the two links that might be helpful:
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.
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
//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();
var result = Resources["InfoTableFunctions"].FromJSON({json: json});