Notifications
Announcements
No record found.
Hi All,
Anyone tried to use Newtonsoft.Json in any X++ (AX) project to read Json String?
*This post is locked for comments
Yes, I did. It's even used by Microsoft in the standard application.
If you have a problem with it, you'll have to tell us what it is.
Hi Martin,
I've follow some post, to create a project in C# then copy and paste .dll to AX folder but it doesn't work and doesn't shown in AOT references.
Is there any documentation or step and procedure how to successfully use it?
What's the exact version of your AX 2012? My R3 already contains the reference out of the box, so there is no reason for adding it.
Anyway, the reference doesn't magically add itself just because some file is copied to some folder. If you want to add a reference to AOT, go to the reference node in AOT and add it by yourself.
If you just compiled the DLL and copied it to the binary folder, that is an incorrect approach.
If you make a Visual Studio C# Project that has a DLL output, adding it to the AX AOT and setting the deployment setting on the solution to be Server/Client is the correct solution. That will automatically deploy the projects' DLL to the VSAssembly folder and will be available.
I'm using AX 2012 R3 CU9.
If it's already there out of the box, can please share how it consume.
I need to read my json string call from aif web services and pass all the value in AX.
JSON is text, therefore "passing it to AX" is exactly the same as with any other string.
The purpose of the Newtonsoft.Json library is serializing objects to JSON and deserializing JSON strings to objects. It seems that you want to deserialize a JSON string to something, but you didn't tell us what the "something" is.
A good strategy may be designing a class in C#, deserialize the string to this class and then consuming the class in a strongly-typed manner in AX via .NET Interop.
I need to read and pass all data in below Json String to AX Variables.
"{"_companyId":"USMF","_purchId":"000023","_packingSlipId":"222","_inboundStrings":[{"RecId":"35637332212","LineNumber":"1","ItemId":"VH001","ReceivedQty":"1"},{"RecId":"35637332213","LineNumber":"2","ItemId":"VH001","ReceivedQty":"1"}]}"
I even tried using,
RetailCommonWebAPI::getMapFromJsonString(jsonString);
but it doesn't work, I always received "Client Object must implement IConvertible.".
When I run my code using Job in AX it's working but when I call it from AIF Web Services got that error.
By the way it don't have issue if i passed Json string below, which only 1 level I also need to pass all the lines:
"{"_companyId":"USMF","_purchId":"000023","_packingSlipId":"222"}"
I'm sorry, but I still don't see any explanation from you to which type you want to deserialize your object. Your code sample mentioned a map - does it mean that you want a map containing an array of other maps? Or what?
What do you think about the solution I suggested in my previous reply? Wouldn't it be easier and safer? This is still my recommendation, unless you make clear that you can't use it for some reason.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 4 Most Valuable Professional
Priya_K 4
MyDynamicsNAV 2