Skip to main content
1-Visitor
May 7, 2020
Solved

Extract data from json by using a subscription

  • May 7, 2020
  • 1 reply
  • 2201 views

Hi,

I'm currently using MQTT to send sensor data to the thingworx platform. The data is in json format and looks like this: 

{"tire_pressure":4.7,"speed":55,"timestamp":"2020-05-07 11:25:19.971","status":"success","vehicle":"car"}

 

In the MQTT master template I created a property called Speedometer which receives this json data. Now, I'm trying to extract the data by using another property (called Speed, base type: int) which subscribes to the Speedometer. The subscription looks like this: 

me.Speed = me.Speedometer.speed;

 

But the property Speed doesn't change it's value. Do you know how to solve this?

 

 

 

 

Best answer by rjanardan

me.Speed= me.Speedometer["speed"];

1 reply

rjanardan16-PearlAnswer
16-Pearl
May 7, 2020

me.Speed= me.Speedometer["speed"];

Lenn1-VisitorAuthor
1-Visitor
May 7, 2020

Thanks a lot!

Unfortunately it worked only once. Now I have always the same value for Speed but the Speedometer json changes every 5 seconds

16-Pearl
May 7, 2020

Is the JSON property getting updated in ThingWorx as well?

Are you using MQTT extension?Which version? Also, have you enabled SSL for communication with the broker?

Please check the logs for any error message.