JSON key
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
JSON key
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
- Labels:
-
Best Practices
-
Design
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Article - "Error when pushing to JSON in ThingWorx Service": https://www.ptc.com/en/support/article/CS284117
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @KN_9954684.
We tested with your code and it's working fine. What does your input look like?
Regards.
--Sharon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Interesting, try using single quote see if it makes a difference or even ... "'12345'" sorry not sure what else you could try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
It doesn't make any difference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Any solution for this case?
