cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

BUG REPORT: getting a json element whose key contains only digits

BP_9999767
3-Visitor

BUG REPORT: getting a json element whose key contains only digits

DESCRIPTION:

Thingworx service does not complete if getting a json element whose key contains only digits.

 

STEPS TO REPRODUCE:

1. Define `test` as a JSON property of a thing
2. Run the following service

 

 

me.test = {"123": "456"}

me.test["123"]
// Java class "org.json.JSONObject" has no public instance field or method named "123"

JSON.parse(JSON.stringify(me.test))["123"]
// Works (workaround)

 

 

 

ERROR MESSAGE:

 

 

Java class "org.json.JSONObject" has no public instance field or method named "123"

 

 

 

VERSION

 9.1.5-b698

 

I'm submitting the bug report here since there is a paywall on the contact us support page and this might be a big issue since it is interpretting the text of the key of the json object as code (or at least as a literal).

1 ACCEPTED SOLUTION

Accepted Solutions
slangley
23-Emerald II
(To:BP_9999767)

Hi @BP_9999767.

 

A fix for this issue was delivered in ThingWorx 9.4 which is now available for download.

 

Regards.

 

--Sharon

View solution in original post

3 REPLIES 3

 Hi,

 

The error you are experiencing was also discussed in the following thread - "How to convert infoTable to json?": https://community.ptc.com/t5/ThingWorx-Developers/How-to-convert-infoTable-to-json/td-p/520804 

slangley
23-Emerald II
(To:BP_9999767)

Hi @BP_9999767.

 

We tested and were able to recreate the issue.  We also found that we have an open bug report on this.  I am following up for a status and will post it here once I receive more information.

 

Regards.

 

--Sharon

 

slangley
23-Emerald II
(To:BP_9999767)

Hi @BP_9999767.

 

A fix for this issue was delivered in ThingWorx 9.4 which is now available for download.

 

Regards.

 

--Sharon

Top Tags