Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
I am trying to assign numbered key to existing JSON but it shows error as per attached screenshot.Please let me know if there is a way for the error
Article - "Error when pushing to JSON in ThingWorx Service": https://www.ptc.com/en/support/article/CS284117
Hi @KN_9954684.
We tested with your code and it's working fine. What does your input look like?
Regards.
--Sharon
It looks like you are treating this JSON as a JSON array and are trying to add a value, I believe your syntax is incorrect.
You are trying to add the value "Mix" to array row 12345
As Vladimir points out with an array you probably would use Push, if it is just a regular object, you would create a 'node' {key:value} and add that to your JSON object.
Since I do all my JSON using google ... I recommend you google it
input is not an array.It is a simple json object.
If we replace "12345" with any string like it works perfectly.
I am not sure why Thingworx is not accepting numbered string key.Please try and let me know if there is any other way
Interesting, try using single quote see if it makes a difference or even ... "'12345'" sorry not sure what else you could try.
It doesn't make any difference
Any solution for this case?