Microsoft Azure iot-hub:通过设备发送到iot-hub的传感器测量值不能读取存储的Json数据.&



我们使用数据采集系统作为设备,并通过MQTT协议将一些信号值发送到分配给物联网集线器的容器中。设备和iot-hub之间的连接工作良好,我们接收到一些JSON数据。当我们打开JSON数据时,我们无法读取"body"中的温度值。在JSON数据中,因为它们是编码的。如果您能告诉我们,我们应该如何自动将JSON数据转换为适当的格式,以便我们可以读取数字中的值,我将不胜感激。

请在JSON数据中找到下面的三行代码。其余的行是相同的,但它们的编码不同。

{"EnqueuedTimeUtc"2022 - 02 - 09年t10:00:30.8600000z","Properties":{"Sensor""},"SystemProperties":{"connectionDeviceId"Iba","connectionAuthMethod":"{"scope"device","type":"sas","issuer":"iothub","acceptingIpFilterRule":零}","connectionDeviceGenerationId":"637799949903534194","enqueuedTime":"2022 - 02 - 09 - t10:00:30.8600000z"},"Body":"My42MjI3NTQ ="}

{"EnqueuedTimeUtc"2022 - 02 - 09年t10:00:30.8750000z","Properties":{"Sensor""},"SystemProperties":{"connectionDeviceId"Iba","connectionAuthMethod":"{"scope"device","type":"sas","issuer":"iothub","acceptingIpFilterRule":零}","connectionDeviceGenerationId":"637799949903534194","enqueuedTime":"2022 - 02 - 09 - t10:00:30.8750000z"},"Body":"My42ODEyNDY ="}

{"EnqueuedTimeUtc"2022 - 02 - 09年t10:00:30.9070000z","Properties":{"Sensor""},"SystemProperties":{"connectionDeviceId"Iba","connectionAuthMethod":"{"scope"device","type":"sas","issuer":"iothub","acceptingIpFilterRule":零}","connectionDeviceGenerationId":"637799949903534194","enqueuedTime":"2022 - 02 - 09 - t10:00:30.9070000z"},"Body":"My43Mzk1OTI ="}

提前感谢!

BrMasoud

您应该向消息主题添加两个参数,例如内容类型(ct)和内容编码(ce),如下面的示例所示:

devices/device1/messages/events/$.ct=application%2Fjson&$.ce=utf-8

相关内容

  • 没有找到相关文章

最新更新