Azure 逻辑应用服务总线消息内容

Azure Logic App service bus message content

我有一个由服务总线触发的逻辑应用程序。消息内容不可用,因为它只是随机字符。我怀疑它可能需要解析,但不清楚如何解析。

我有以下内容: Not enough reputation to add an image - but screen shot from Azure

 "Insert_Entity": {
            "inputs": {
                "body": {
                    "PartitionKey": "deviceID",
                    "RowKey": "@variables('curDate')",
                    "content": "@triggerBody()?['ContentData']"
                },

当我查看来自“@triggerBody()?['ContentData']”的 "content" 数据时,它看起来像这样:

"W3sidHlwZSI6ImxvZyJ9LF...." 我删除了大部分内容,因为它有 100 个字符长。

我怀疑这需要解析或查看实际的消息正文。我已经检查过了,但不知道在哪里插入这样的代码:

能否请您解释一下如何查看邮件正文。

Can you please explain how to see the message body.

你说的字符串W3sidHlwZSI6ImxvZyJ9LF....是base64string。如果我们想看到消息 body 我们需要将 base64string 转换为 string

我们可以做到 base64ToString(triggerBody()?['ContentData']) 详情请参考截图。

Body 信息:

在获得 Tom Sun 解决方案的值后,我不得不提取结果的 json 部分以便能够解析它,Logic App Expression :

substring(
variables('result'),sub(indexOf(variables('result'),'{'),1),
sub(lastIndexOf(variables('result'),'}'),indexOf(variables('result'),'{'))
)

然后使用 Parse JSON 函数使用模式解析结果:

{
    "properties": {
        "data": {
            "type": "string" // Change As Required
        },
        "dataVersion": {
            "type": "string"
        },
        "eventTime": {
            "type": "string"
        },
        "eventType": {
            "type": "string"
        },
        "id": {
            "type": "string"
        },
        "metadataVersion": {
            "type": "string"
        },
        "subject": {
            "type": "string"
        },
        "topic": {
            "type": "string"
        }
    },
    "type": "object"
}