how to Import json file to navision Table

Rajan123Rajan123 Member Posts: 20
Hi all,
I am new to Navision,
can anyone of you tell me , how to import json file to Navision ?


thanks,
Rajan.

Answers

  • ResolusResolus Member Posts: 40
    1. First of all you'll need to import the file into a stream.
    2. The stream you can then convert to a textvariable.
    3. Then in AL you can use Json variables, or in C/AL you need to use DotNet for Json.
    4. You parse the text variable to a Json Object/Array (check wether the first character in the text string is [)
    5. From this moment on you have a Json Object/Array. Either you handle the Json object directly. Then use the SelectToken method on the Json Object for every field/element you want to load from Json into Navision and assign it to the correct navision field.
      If you have an array, you need to obviously loop through the array and then do the previous steps.

    Thats about it, not all too complex.
    I'm certain you can find many examples on Mibuso about working with Json or importing a file to Blob.
  • SanderDkSanderDk Member Posts: 456
    It is actually quite impossible to give you a good answer because it depends on a lot of things and mostly on your version of Navision (or BC).

    Ex. if you are on a newer BC, then the datatypes json will help, if you are on a newere NAV version then the Json Buffer is you friend, if you is on a old NAV (but still RTC) then perhaps json newtonsoft is your friend and lastly if you are on oldere NAV Classic the the code would be complety different.
    For help, do not use PM, use forum instead, perhaps other people have the same question, or better answers.
  • Rajan123Rajan123 Member Posts: 20
    thank you so much for your replies.

    using json buffer, can we import from external api json file to navision table.
  • Rajan123Rajan123 Member Posts: 20
    I am using Nav 2018
  • SanderDkSanderDk Member Posts: 456
    Yes, you will have to retrive the JSON response from the API and load it into the json buffer
    For help, do not use PM, use forum instead, perhaps other people have the same question, or better answers.
  • Rajan123Rajan123 Member Posts: 20
    do you have any sample data for retrieving json file?
  • SanderDkSanderDk Member Posts: 456
    Hi @Rajan123 Well without knowing what kind of API you are accessing, I cannot provide any thing useful, try have a look at Eric Hougaards' youtube https://www.youtube.com/c/ErikHougaard
    For help, do not use PM, use forum instead, perhaps other people have the same question, or better answers.
  • Rajan123Rajan123 Member Posts: 20
    thanks @SanderDk. I shall Look into the Eric Hougaards' youtube.
Sign In or Register to comment.