Node-Red - MQTT上的JSON - 删除String

时间:2017-03-31 18:20:08

标签: json mqtt node-red

通过MQTT关于JSON的问题 Raspberry pi w / gps通过MQTT向服务器发送位置数据。服务器接收到的所有信息都很好,但是,有效载荷在收到时是一个字符串。

如何删除""来自我的json。

来自GPS模块的Raw:

2017年3月31日,下午2:13:29 PMec04f460.a91eb8 msg.payload:Object

{" class":" TPV"," tag":" RMC"," device":& #34; / dev / ttyUSB0","模式":3,"时间":" 2017-03-31T18:14:48.000Z",& #34; ept":0.005," lat":29.844941667," lon":-81.277976667," alt":2.2," epx&# 34;:45.649," epy":10.829," epv":4.945," track":171.72," speed":0.046,& #34;攀登":0," eps":91.3," epc":9.89}

通过Node-Red直接发送到MQTT服务器

服务器接收:

2017年3月31日,下午2:16:26节点:d369167f.b8ea58 trolley281 / gps:msg.payload:string [251]

" {"类":" TPV""标记":" RMC""设备&# 34;:"的/ dev / ttyUSB0""模式":3,"时间":" 2017-03-31T18:17:46.0​​00Z&# 34;," EPT":0.005," LAT":29.844945," LON": - 81.277986667," ALT":2.9,&# 34; EPX":45.649," EPY":10.829," EPV":4.945,"跟踪":166.53"速度" :0.005,"爬":0," EPS":91.3," EPC":9.89}"

作为一个字符串......

任何人都知道如何清理它?

1 个答案:

答案 0 :(得分:0)

在调色板中查找JSON节点,它会将JSON字符串转换为JSON对象(反之亦然)。

enter image description here