Azure Logic Apps - Get Blob Content - Setting Content type
Workaround I found is to use the Logic App expression base64ToString.
For instance, create an action of type "Compose" (Data Operations group) with the following code:
"ComposeToString": { "inputs": "@base64ToString(body('Get_blob_content').$content)", "runAfter": { "Get_blob_content": [ "Succeeded" ] }, "type": "Compose" }
The output will be the text representation of the blob.
So I had a blob sitting in az storage with json in it.Fetching blob got me a octet back that was pretty useless, as I was unable to parse it.
BadRequest. The property 'content' must be of type JSON in the 'ParseJson' action inputs, but was of type 'application/octet-stream'.
So I setup an "Initialize variable", content type of string, pointing to GetBlobContent->File Content. The base64 conversion occurs under the hood and I am now able to access my json via the variable.
No code required.
JSON OUTPUT...
FLOW, NO CODE...
Enjoy! Healy in Tampa...
After fiddling much with Logic Apps, I finally understood what was going on.
The JSON output from the HTTP request is the JSON representation of an XML payload:
{ "$content-type": "application/xml", "$content": "77u/PD94bWwgdm..."}
So we can decode it, but it is useless really. That is an XML object for Logic App. We can apply xml functions to it, such as xpath.