I was wondering if there is a way to parse a JSON response from an api request in Logic apps in Azure, to xml format?
what i want to do is to later add an XML validation to validate my XML with my XSD file.
I was a reading a bit on WDL (Workflow definition language) and got the understanding that this is possible...
can this be done with the designer in azure?
-----------Edit---------------
Ok so i got this to work, sort of..
I had to concatenate the "triggerBody()" of my HTTP action with the root-tag of the xml..
and that feels wrong, there must be som way of being able to reash the root tag so that it understands to validate the whole object with the xsd..
here are some screenshots:
It can be done in designer but is trickier than it should be. We are honestly days away from shipping a feature to let you parse JSON in the designer, but will likely ship shortly after new year with holidays. Anyway - the JSON response from an action can be grabbed (in code-view or by typing this into the designer) with
@body({the-name-of-the-action})
- so something like@body('http')
. You could parse properties with something like@body('http')['foo']['bar']
. If the content-type isn't correctly set on response asapplication/json
you can 'cast' to JSON with@json()
- so@json(body('http'))['foo']
Finally - you can convert to xml with
@xml()
- so@xml(json(body('http')))
would take the body of HTTP, convert it to JSON (may not be necessary) and transform it to XML.