azure - How to parse a message in Azure IOT hub logic app
问题描述
I am trying to understand how to get content into a logic app email (or into the conditioning search in the logic app).
I have an IOT device sending a standard message to the hub (the demo temperature app). This works fine.
I have added a service bus and routing and again all ok.
I then want a logic app to send an email either using some of the content of the message, or even to use the conditional processing in the logic app.
I am using the connector in the logic app to the service bus.
When I try emailing dependant on the conditional "Content contains Startup" the email goes successfully but only down the false route.
When I try to put a JSON parse step in is returns invalid as the content isn't in JSON format.
The Error message:
InvalidJSON. The 'content' property of actions of type 'ParseJson' must be valid JSON. The provided value 'e3sid2ZNZXNzYWdlVHlwZSI6IFN0YXJ0dXAsInRlbXBlcmF0dXJlIjogMzcuMzMsImh1bWlkaXR5IjogNjEuMjV9' cannot be parsed: 'Unexpected character encountered while parsing value: e. Path '', line 0, position 0.'.
解决方案
很难准确理解问题发生在哪里,但看起来你的字符串在 base64 中。
您可以尝试使用以下方法进行转换:
base64ToString(triggerBody()?['whateveryourvariablenameis'])
查看此屏幕截图和更多信息: Azure Logic App 服务总线消息内容
推荐阅读
- python - 如何在numpy中将范围编码为固定值
- if-statement - Nginx if 语句重写
- python - 如何删除命令的当前通道。不和谐.py
- rdf - 是否可以忽略 Apache Jena 中的 RiotParseException?
- mulesoft - 如何在 mulesoft 中使用 JAVA 组件传递 JSON 数组,因为如果我传递 JSON 数组会出错
- c# - 如何设置变量:Unity 中可配置关节的 AngularXDrive 和 AngularYZDrive?
- python - 如何获取引导 html标签 id 的 id 并将其传递给 django views.py?
- excel - 在excel vba中设置后系列名称为空
- django - 将值从选择标签传递到views.py
- init - AttributeError:模块'pyttsx3'没有属性'init',但我尝试了一切