Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Export Data through web service in json format

(0) ShareShare
ReportReport
Posted on by

Dear All Expert,

 I want to Sales Invoice List page data export in json format through webservice. But version is Nav 2009.

Regards,

Jeet patadiya

*This post is locked for comments

  • Suggested answer
    Suresh Kulla Profile Picture
    47,789 on at
    RE: Export Data through web service in json format

    Jeet,

    You can try this function to convert to JSON

    PROCEDURE ConvertToJson@1240060005(VAR TempBlob@1240060000 : Record 99008535);

       VAR

         XmlDocument@1240060003 : DotNet "'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.XmlDocument";

         JsonConvert@1240060002 : DotNet "'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'.Newtonsoft.Json.JsonConvert";

         JsonText@1240060001 : Text;

         JsonFormatting@1240060004 : DotNet "'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'.Newtonsoft.Json.Formatting";

         InStr@1240060005 : InStream;

         OutStr@1240060006 : OutStream;

       BEGIN

         TempBlob.Blob.CREATEINSTREAM(InStr);

         XmlDocument := XmlDocument.XmlDocument;

         XmlDocument.Load(InStr);

         JsonText := JsonConvert.SerializeXmlNode(XmlDocument.DocumentElement,JsonFormatting.Indented,TRUE);

         TempBlob.INIT;

         TempBlob.Blob.CREATEOUTSTREAM(OutStr,TEXTENCODING::UTF8);

         OutStr.WRITETEXT(JsonText);

       END;

  • Community Member Profile Picture
    on at
    RE: Export Data through web service in json format

    But sir you have idea how to use json array in navision because invoice have multiple line.

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at
    RE: Export Data through web service in json format

    With NAV 2009 you have SOAP web services with XML. If you have to publish NAV data for an external application and you require JSON, I suggest you to write a "middle tier" web service that retrieves data from NAV (using standard WS) and then return JSON to the caller application. The caller application will call your newly created WS and not the NAV WS directly.

    Otherwise, you can create a codeunit that returns JSON as described here:

    demiliani.com/.../serialize-nav-objects-as-json

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics NAV (Archived)

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2

#1
mmv Profile Picture

mmv 2

#1
Amol Salvi Profile Picture

Amol Salvi 2

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans