Filburt Filburt - 2 months ago 100x
JSON Question

Parsing Service Bus Queue message in Logic App parameter function

I receive a error from my SharePoint Get-Item action when I try to use data from the Service Bus message triggering my Logic App (inner xml omitted):

Unable to process template language expressions in action 'Get_items' inputs at line '1' and column '1641': 'The template language function 'json' parameter is not valid. The provided value '
<?xml version="1.0" encoding="utf-8"?>
<Projektaufgabe id="b92d6817-694e-e611-80ca-005056a5e651" messagename="Update">
' cannot be parsed: 'Unexpected character encountered while parsing value: . Path '', line 0, position 0.'.

The decoded message xml looks okay even quoted in the error message.

The received queue message body seems okay - only the ContentType is empty:
(ContentData truncated)

"ContentData": "77u/PD94bWwgdmVyc2lvbj0iMS4wIiBl...=",
"ContentType": "",
"ContentTransferEncoding": "Base64",
"Properties": {
"DeliveryCount": "1",
"EnqueuedSequenceNumber": "20000001",
"EnqueuedTimeUtc": "2016-07-29T09:03:40Z",
"ExpiresAtUtc": "2016-08-12T09:03:40Z",
"LockedUntilUtc": "2016-07-29T09:04:10Z",
"LockToken": "67796ed8-a9f0-4f6a-952b-ccf4eda00071",
"MessageId": "f3ac2ce4e7b6417386611f6817bf5da1",
"ScheduledEnqueueTimeUtc": "0001-01-01T00:00:00Z",
"SequenceNumber": "31806672388304129",
"Size": "1989",
"State": "Active",
"TimeToLive": "12096000000000"
"MessageId": "f3ac2ce4e7b6417386611f6817bf5da1",
"To": null,
"ReplyTo": null,
"ReplyToSessionId": null,
"Label": null,
"ScheduledEnqueueTimeUtc": "0001-01-01T00:00:00Z",
"SessionId": null,
"CorrelationId": null,
"TimeToLive": "12096000000000"


My parsing function for the SharePoint Get-Item OData filter looks like this:


I already tried to separate decoding and casting to string:


Since it seems to be an issue decoding the message, I reckoned it wouldn't help much receiving a json message instead of xml from the Service Bus queue.


So from what I can see you are trying to convert an xml to json. You are very close - only issue is @json() expects either

  1. A string that is a valid JSON object
  2. An application/xml object to convert to JSON

Here, the @base64toString() is converting to a string, but you really need to let @json() know this is #2 and not #1, so changing expression to this should work:


Let me know