In my last post, I wrote about event based integration using Business Events. I used JSON as my export file type. JSON is a lot easier to work with in Microsoft Flow or Azure LogicApp.
Below is how I achieved it.
Below is how I achieved it.
A bit of googling and trial and error. I found this XSLT code that transformed XML to JSON.
https://gist.github.com/bojanbjelic/1632534
Here is the authors blog post to give credit.
https://www.bjelic.net/2012/08/01/coding/convert-xml-to-json-using-xslt/#code
Setup
Under the Data management workspace, open the Source data format form. Create new record called JSON and set the default extension to json.- File format = XML
- XML Style = Attribute
- Root element = Document (I left this as default)
Create a new Export and select your entity. In the Source data format, select JSON record that was created in the previous step.
Now click on the View map icon.
In the mapping form, click on the Transformations tab. Then upload the xslt file you downloaded from the github.
That's it for the set up. Now to run it.
Process
Normally when you export and XML file. It looks like this:Once the transformation is applied, you get a JSON file like this.
This is great because I like to use Microsoft Flow or LogicApps to read the files to process. With XML you have to use XPATH or figure out otherwise to read it.
This works very nicely and no development or extra transformation at the target.