Update 03/08/16:
Logic Apps has gone GA, and has undergone a major v2 change since this post was written. For the most part, the core actions remain the same but just renamed or work a little differently e.g. http listener (now known as "When an http request is received" + "Received") and conditions (now triggered via the add a condition" button instead of being configured inside the http action.)
It is worth noting that the BizTalk JSON Encoder API app can no longer be found in the marketplace. This is now a native function in Logic Apps. Though, I'll try to refresh this post with the how to do it in the version of Logic Apps that GA'd, I'm not sure when I will have to do it, so if you can't wait, I suggest looking at the xml function can be found here.
Update 07/08/16:
Steps for new Logic App UI that has GA have been added into the solution section below.
The problem
One of the things I have been working on lately in the Nintex Workflow world, is interacting with various software as a service based solutions within a workflow via REST based APIs.
One of the things we will find is that with the growing popularity of JSON, some REST based web services are no longer supporting returning responses of web requests in the XML format.
Workflows in SharePoint, has traditionally been focused around integrating with enterprise level SOAP based web services and Nintex is well catered in this area with it's Query XML Action. Unfortunately (as of the time this blog was written), there is currently no equivalent Query JSON Action within Nintex Workflow for On Premise.
The options
- Simple JSON structures: In most cases the JSON responses returned by APIs are simple and flat in structure.
- For this scenario, we can leverage (with relative ease) the regular expression capabilities within Nintex Workflow to parse the JSON string. A great example of this can be found from Vadim Tabakman's blog in Nintex Community: Uber price estimate UDA
- Complex JSON structures: In some cases JSON responses returned by API's can be nested and/ or contain arrays. Parsing responses of this nature using the regular expression can be more challenging.
An example of a nested structure
If only there was a way to easily convert JSON into XML so that we can leverage the Query XML action...
Well, the relatively recent introduction of the new Logic App and API App platfrom from Microsoft Azure looks to be a great timing. In the next section, we will look at how we can leverage Azure to easily create our own API to convert a JSON string into an XML string so that we can use the capabilities of Nintex's Query List action to retrieve information we need from a web service response.
Moving parts from Azure:
- Logic App: This is the platform that allows us to orchestrate and glues a combination of API Apps together.
- When an HTTP request is received: This API app triggers the start of the logic app (pictured above) when it receives a web request. Just add the action (there is no need to configure anything else).
- Response: This API app is used to send back the converted XML string as a response to the application that sent the initial web request (e.g. Nintex Workflow). Ensure you configure the body field with "@xml(triggerBody())" which converts the content from the body of the HTTP request from JSON to XML.
![]() |
Nintex Workflow - Leveraging Azure to convert a JSON response into XML so that we can parse the information with the Query XML action |
Moving parts from Nintex Workflow:
- Web Request (JSON Conversion): This action is used to call the API created in Azure Logic Apps (including passing the JSON string we want to convert into the XML)
URL: Copy the URL that is generated in your "When an HTTP request is received" action.
Request Type: POST
Content Type: "application/json" (This is very important as it ensures the JSON string you pass to the Logic App is converted into a JSON object before the logic app tries to convert it into XML. Failure to do use this content type may result in an error).
Authorization: No longer requiredThis configurations shown in this screenshot is a little outdated. Please refer to the notes above for configuration. - Query XML: This action is used to parse through an XML document to retrieve necessary information.
Next Steps
If you would like to try the azure logic apps and API apps out yourself, I would recommend reading the following blogs and articles to get started:
Do you also work with JSON based REST API in Nintex Workflow? Please feel free to share how you address this particular scenario in the comments below.