Unable To Convert From com.thingworx.types.collections.ValueCollectionList to JSON
Unable To Convert From com.thingworx.types.collections.ValueCollectionList to JSON
Within my service ParentService (with output type set to InfoTable) I call ChildService service which returns result: INFOTABLE dataShape: "undefined" and I set result to that InfoTable so this can be converted to JSON so a Rest client can ask for JSON response.
This "undefined" Infotable when converted to JSON will have this shape:
{
"dataShape": {...},
"rows": [{firstobj}, {seconobj}...]
}
I want to return only result.rows, but that is treated as ValueCollectionList which cannot be converted to JSON.
I used InfoTableFunction's ToJSON service and I got almost what I wanted with .rows, but now I need to remove{ "array": part and only get this as a return object:
[{obj1},{obj2},{obj3}]. I want then to save this json return value to a repository file. So how can I do that?
It is a strange that "array" property is added. I don't want to have a wrapping object with this "array" property.
var jsonResult = Resources["InfoTableFunctions"].ToJSON(params);
var result = jsonResult.rows;
{ "array": [ { "MappingType": "analog", "defaultValue": "0.0", "name": "n1" }, "MappingType": "digital", "defaultValue": "false", "name": "n2" }, ] }
Any suggestions?
Thanks

