Showing posts with label JSON. Show all posts
Showing posts with label JSON. Show all posts

Tuesday, March 31, 2015

AX2012 JSON 2 XML converter


While writing some code for the Exchange Rate Provider class, I ran across an issue where some exchange rate provider APIs only gave JSON output instead of XML.  I found very little in Dynamics AX that would let me deserialize JSON.  The only alternative was to manually parse the data based on the structure provided at the time.

I didn't like that approach.  Manually parsing data like that can be a nightmare.  The only tools I know of in Dynamics AX are the XML tools.  With that in mind, I decided to write a JSON to XML converter.

classdeclaration


loadFromFile


convert2xml

convert

getTag




Sample JSON exchange rate data from Fixer.io.



XML version after running it through the converter.