Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hi,
I followed this document CS 179012 (https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS179012&lang=en&source=snippet)
for converting a json in an Infotable but it doesn't work.
First of all i created a Json like that;
name file "sample_json
{
"ID" : "Nicolas",
"SortAs" : "22",
"GlossTerm" : true,
"Acronym" : "Male",
}
and i move it in ThingworxStorage folder.
Using service LoadJson i do not see anything .
I tried anyway to create a new service like that
var params = {
path: "/ThingworxStorage/jsample_json.json" /* STRING */
};
var jsondata = me.LoadJSON(params);
var params = {
infoTableName : "InfoTable",
dataShapeName : "DS_test_jason"
};
// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):iNFOTABLE(DS_test_jason)
var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);
/reading json file and put it in infotable
for (var elem in jsondata) {
//for(var i=0;i<jsondata.array.length;i++){
InfoTable.AddRow({ID:elem.ID});
// var newEntry = new Object();
// newEntry.ID = elem.ID;
// result.AddRow(newEntry);
result = InfoTable;
}
//}
The result is an infotable with its fields but without values for any fields.
This extension https://marketplace.thingworx.com/Items/Parsley_Extension results alreay installed.
I fina also this note: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS232916&lang=en&source=snippet , they give me another different example of Json Object :
{"rows":[
{"name":"meghan","count":42},
{"name":"aanjan","count":13},
{"name":"polina","count":24},
{"name":"saeed","count":75}],
"dataShape":{"fieldDefinitions":{
"name":{"name":"name","aspects":{"isPrimaryKey":true},"description":"Entity type name","baseType":"STRING","ordinal":1},
"count":{"name":"count","aspects":{},"description":"Total Count","baseType":"INTEGER","ordinal":2}}}}
and also they are talkng about using
var result = Resources["InfoTableFunctions"].FromJSON(params);
It is not clear the real procedure in order to achieve my goal.
Can you help me ?
Please
I thought it was the same procedure like reading a text file but with different function.
Hi Marco, for any technical questions, please post these in the developer community. Please let me know if you do not receive a reply.