NAV Web Service to read and parse JSON stream

tarkmylertarkmyler Member Posts: 57
edited 2015-03-01 in NAV Three Tier
I have a client that uses a cloud based customer service application call ZenDesk. Targets and Triggers can be defined in the application to send "ticket" information. I got excited about it and created an XMLPort and corresponding Codeunit. I added it to the Web Services. I even wrote a C# window application \:D/ to enter and send data in XML format to my new web service. I was all set to receive xml documents representing customer service tickets and turn those into interactions in NAV.

However, today I find that Zendesk uses JSON format, not xml. ](*,)

There isn't much in the forums regarding JSON, and certainly no examples in C/Side. I dredged up a couple of links, like:

I suppose that I could try and reference something like this with the new .NET variable type, but I'm still having a tough time figuring out if I try and read a stream or what exactly I do on the C/Side to read and processs a JSON data stream.

Help! :?
Mark Tyler
Pacific City, OR


  • Options
    jlandeenjlandeen Member Posts: 524
    I have not been able to find any simple out of the box solution to handle JSON requests directly in NAV. But with the advances of moving to the cloud in NAV 2015 and beyond, this is something that is hopefully addressed natively in the near future.

    In the meantime I think the best solution is to build a wrapper class in .NET and is called by NAV. There are several implementations of JSON serializer tools and REST tools that can be used in .Net to allow you to work with JSON based web services (which seems to be a very common pattern for Cloud API's). There is at least one MSDN article on how to expose OData queries as JSON (see: http://msdn.microsoft.com/en-us/library/dn127071(v=nav.71).aspx)
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

  • Options
    SiStSiSt Member Posts: 46
    If you want to use the .NET approach take a look at James Newtonking's Json.net (http://james.newtonking.com/json)

    I also posted a small example how it is possible to parse JSON in NAV, but you have to write a lot of code:
  • Options
    tarkmylertarkmyler Member Posts: 57
    Thanks for the suggestions! :lol:
    Mark Tyler
    Pacific City, OR
  • Options
    rthswrthsw Member Posts: 73
    just for the case someone is interested:
    for connecting a Navision with Shopware i wrote my own REST/JSON Wrapper direct in Navision without any additional software.

    Natural there is a external component, but only Microsoft components you find on every Windows-computer since 2003/Xp, so you don't need to setup any DLL's, programms or whatever on the using client computers.

    Currently the page is only in German because Shopware is very (only?) popular in Germany, but the examples are easy to read (just ignore the german text).

    https://sites.google.com/site/renethoen ... e-mit-josn

    If you want to drive a Shopware system out of Navision you might also be interested in a complete PIM Solution direct inside of Navision.
    Also in German but with a lot of explaining Pictures:


    Hope i can help someone with this. Both Solutions are also to sell. Documentation will be more in the future.
Sign In or Register to comment.