How to create Thingworx extension for converting data from json object to infotable
Hi Everyone,
I am having troubles while creating Java extension for converting data from JSON to INFOTABLE, I have tried multiple methods and no seem to work.
@ThingworxServiceDefinition(name = "JsontoInfo", description = "", category = "", isAllowOverride = false, aspects = {
"isAsync:false" })
@ThingworxServiceResult(name = "Result", description = "", baseType = "INFOTABLE", aspects = {
"isEntityDataShape:true", "dataShape:DemoDS" })
public InfoTable JsontoInfo(
@ThingworxServiceParameter(name = "input", description = "", baseType = "JSON", aspects = {
"defaultValue:{\"name\":\"Abcd\",\"salary\":25000,\"married\":true}" }) InfoTable input) {
_logger.trace("Entering Service: JsontoInfo");
_logger.trace("Exiting Service: JsontoInfo");
return input;
}
ERROR: Unable to Invoke Service JsontoInfo on TestResJson2info : Cannot cast org.json.JSONObject to com.thingworx.types.InfoTable
if anybody Know any solution regarding this, Kindly share it ASAP.
Thanks & Regards
Raviteja L.

