I have logic app that is triggered by a service bus. The message content is not usable as it is just random characters. I suspect that perhaps it needs to be parsed but it is not clear how to do this.
I have the following: Not enough reputation to add an image - but screen shot from Azure
"Insert_Entity": {
"inputs": {
"body": {
"PartitionKey": "deviceID",
"RowKey": "@variables('curDate')",
"content": "@triggerBody()?['ContentData']"
},
When I look at the data that I am getting for the "content" coming from the "@triggerBody()?['ContentData']" it looks like this:
"W3sidHlwZSI6ImxvZyJ9LF...." I deleted most of this as it 100's of characters long.
I suspect that this needs to be parsed or something to look at the actual message body. I have checked this out but don't know where to insert code like this: Getting content from service bus in logic apps
Can you please explain how to see the message body.
Can you please explain how to see the message body.
The string W3sidHlwZSI6ImxvZyJ9LF....
you mentioned is base64string. If we want to see the message body we need to convert the base64string to string
We could do that with base64ToString(triggerBody()?['ContentData'])
details please refer to the screenshot.
Body info:
After getting the value as Tom Sun solution, i had had to extract the json part of the result to be able to parse it, Logic App Expression :
substring(
variables('result'),sub(indexOf(variables('result'),'{'),1),
sub(lastIndexOf(variables('result'),'}'),indexOf(variables('result'),'{'))
)
Then use Parse JSON function to parse the result using the schema :
{
"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"
}
来源:https://stackoverflow.com/questions/47399765/azure-logic-app-service-bus-message-content