How to generate Json file using X++ in AX 2009

How to generate Json file and send it to cloud base third party software in AX 2009 ?

You can either construct a JSON string by yourself, or you could use a .NET library where you would populate an object with data and serialize it to JSON with NewtonsoftJson.

Thanks for reply Martin. I have trying with .NET library for that, I have added Newtonsoft.Json.dll @ C:\Program Files (x86)\Microsoft Dynamics AX\50\Client\Bin & added reference in AOT references, but i don;t no how to populate an object with data. Can you help me regarding that.

I would create a custom library with a public C# class representing the data. Then you would instantiate this class from X++ and fill it in (note that if you use properties in C#, you must use methods like set_MyProperty() to set values).

In D365FO, you can also easily serialize Map objects with Newtonsoft.Json, but I think it wouldn’t work in AX 2009.

We have generated simply text file with .json extension & it’s works fine.