Azure Functions – Convert Json to Xml with newtonsoft

I’m in the midst of putting together a few Azure Functions to use with Logic Apps.
This one is pretty simple, and demonstrates a couple of concepts so I thought I’d share.

2 thoughts on “Azure Functions – Convert Json to Xml with newtonsoft”

  1. Gord,
    I am looking for help doing the same type of thing. I need to get an XML/CSV file from FTP (I can do), Transform XML with BizTalk Map to Corrected XML Structure (I can do) and then the part I am stuck on….
    I need to flip the XML to JSON. Bummer.. I know the @json(xml(….. will work for the entire file, but the issue is with Arrays. Sometimes the XML has multiple elements, sometimes not. The outgoing JSON always needs to have certain elements defined as array with [], even when single element. Logic App is not working for me, So I wanted to use Azure Function to accept a XML file as a whole, then flip to JSON, but allow me to control which elements are arrays [] and which ones are not. I know the three elements that always need to be arrays, even as single elements.

    I have little to zero experience doing this. I have been out of coding for years. But this seems simple enough. Any chance you could help get me through this?

  2. Hi ,
    I am trying to convert json to xml format using Azure functions but i am getting the following errors.
    2017-09-27T04:55:53.921 Function compilation error
    2017-09-27T04:55:53.921 run.csx(4,7): error CS0246: The type or namespace name ‘Newtonsoft’ could not be found (are you missing a using directive or an assembly reference?)
    2017-09-27T04:55:53.921 run.csx(24,32): error CS0103: The name ‘JsonConvert’ does not exist in the current context

    Azure function is not found the “Newtonsoft” namespace. Could you please tell me how to include this.

Leave a Reply

Your email address will not be published. Required fields are marked *