web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Create and use JSON object in Dynamics AX

(0) ShareShare
ReportReport
Posted on by

Hello,

Is there any object of JSON, I can use in Dynamics AX (2009).

Need example doing that, please.

Thanks :)

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at
    RE: Create and use JSON object in Dynamics AX

    Hi Experts

    We are trying to integrate external application with AX 2012. The provided API format is JSON we are able to connect API for login method and get response. If we try to access any other method we are getting error because we are not able to call the login method and the consecutive method in the same request sessions in AX. Can anyone guide us to understand how we can handle  JSON session within AX also please guide us to understand serialize and de-serialize JSON .

    Thanks for advance!!!!

  • Suggested answer
    Brian Kinser Profile Picture
    815 on at
    RE: Create and use JSON object in Dynamics AX

    I deserialize using the RetailCommonWebAPI .....but I check for value in each conpeek before trying to use it.....I noticed in the client that it just showed blank while the batch mode it failed.....not sure why

  • tony.lim@junctionsolutions.com Profile Picture
    on at
    RE: Create and use JSON object in Dynamics AX

    Hi Neetu,

    I believed someone in my organization wrote their own version to de-serialize the Josn string. I wasn't involve with that process. Sorry I couldn't be much help.

  • Neetu Chamling Profile Picture
    351 on at
    RE: Create and use JSON object in Dynamics AX

    Hi Tlim,

    I am also facing same error in batch mode in side RetailCommonWebAPI call.

    in non-batch mode, it works fine..

    during batch mode processing got above mentioned error.

    gave CLRobject assert permission too. yet same error during batch mode.

    how did you resolved your issue. kindly share .

    Thanks

    Neetu

  • tlim Profile Picture
    on at
    RE: Create and use JSON object in Dynamics AX

    My json string is pretty simple {"CompanyId":"001","TransactionType":"100","Ranch":"200004","ItemId":"000000005","Qty":"2"}. What I found was that it is crashing at this statement:

    deserializedCollection = new System.Collections.Hashtable(_dict);

    in getMap Method with this error:

    get_InnerException System.InvalidCastException: Object must implement IConvertible.
    at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
    at Dynamics.Ax.Application.RetailCommonWebAPI.getMap(Object _dict) in RetailCommonWebAPI.getMap.xpp:line 11
    at Dynamics.Ax.Application.RetailCommonWebAPI.getMapFromJsonString(String _jsonString) in RetailCommonWebAPI.getMapFromJsonString.xpp:line 25
    at Dynamics.Ax.Application.drscl_JSONStagi

    It worked fine when running it in the AOT Job but it is crashing when running IT in the batch or calling it from a WCF Custom Service.

  • Jonathan  Halland Profile Picture
    11,310 on at
    RE: Create and use JSON object in Dynamics AX

    Tlim

    What was the structure of the JSON that you were trying to return? Was there any binary or other strange data types in it? The RetailCommonWebAPI is customisable so you could for certain elements choose to not deserialise them

  • tlim Profile Picture
    on at
    RE: Create and use JSON object in Dynamics AX

    Hi Eitan, I was trying to use RetailCommonWebAPI to deserialize json but getting "Must implement IConvertible" error. So now, I'm looking at alternatives. Can you share how you developed your own JSON deserializer? Thanks.

  • Community Member Profile Picture
    on at
    RE: Create and use JSON object in Dynamics AX

    Sorry Yasir - I will send you some private message.

    Good luck.

  • Verified answer
    Community Member Profile Picture
    on at
    RE: Create and use JSON object in Dynamics AX

    That's was long time ago I opened this thread.

    There were many things work not properly for this dlls (I have checked that), because json presume being binary, while there is try to set it as string (and like C#, it has some extra characters for specials .... such as // - json shall add /unnnn for special characters.

    There are lot of problems, not mentioned, and since I need also pure "REST" for json (not that encapsulated by some xml), I did parsing myself, by supporting query+datacontract (for ax 2012), but I don't think I deal with json for ax 2009.

    This is closed issue.

    Thanks, anyway :)

  • YasirGodil Profile Picture
    204 on at
    RE: Create and use JSON object in Dynamics AX

    Hi Eitan,

    Were you able to use JSON in AX2009. I know we have NewtonSoft DLLs that we can use to parse the JSON data in AX. However, I am looking for some native solution. Were you able to find any?

    Yasir

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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#2
Community Member Profile Picture

Community Member 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans