Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
When trying to use JSON.stringify(), I'm getting the below error:
ERROR:: Can't find method com.thingworx.types.primitives.structs.Location.toJSON(string)
Already validated that the format of the JSON I'm trying to stringify is correct using online json validator.
Please find the JSON I'm trying to stringify attached. At the end of the file you can find the Location property, which when removed, stringify() is working fine. I'm not able to understand why it's not working if the format is correct.
Any help is greatly appreciated
Solved! Go to Solution.
Hey @slangley , Good day!
We're currently using Thingworx 8.5.19 version.
Yes, the stringify function is not working on the attached json, but the good news is that we found a work around so there is no blocker.
I created a service with input type JSON and output type string and executed following code result = JSON.stringify(jsonInput);
It executed without any error when I passed your JSON in input.
Can you share your service code?
Regards,
Sachin Sharma
Please find the file attached.
There are 2 main functions
The JSON that you parsed previously, we got it by converting the infotable to JSON using preparePayload().
please let me know if there is any confusion and thanks for your response!
Hi @Rishabh345.
Which version of ThingWorx are you running? Are you saying that you're still having an issue when you try to stringify the json you attached to your post?
Have you checked the ThingWorx logs?
Regards.
--Sharon
Hey @slangley , Good day!
We're currently using Thingworx 8.5.19 version.
Yes, the stringify function is not working on the attached json, but the good news is that we found a work around so there is no blocker.