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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

How can i get the value of JsonArray(Index) dynamically?

(0) ShareShare
ReportReport
Posted on by 45

Hello All,

I am facing issue while parsing Jsonarray, below is the format of my response.

  1. [
      {
        "LSM65V-LAPCS-UVUVBB": {
              "refid": "AYPSDHN-LNKEIX-CLE447",
              "time": 1624359464.3967
       },
         "LQISDV-4GYXL-SEF3XD": {
              "refid": "AYPOYQW-LOY3XV-37JRNV",
              "time": 1624354850.4089
        }
      }
    ]

I want to dynamically get values LSM65V-LAPCS-UVUVBB and LQISDV-4GYXL-SEF3XD, So is there any way to do that?

So, based in that i will get the values of refid and time.


Thanks & Regards

I have the same question (0)
  • Sangit Panchal Profile Picture
    45 on at

    Issue resolved.

  • Andy Sather Profile Picture
    on at

    I am glad your issue is resolved.  Do you have the resolution that you found for others in the community?

  • Suggested answer
    Tabrez Ajaz Profile Picture
    785 on at

    Good to hear that your issue is resolved:

    You can read my content in which I have written code to handle REST Responses:

    tabrezblog.azurewebsites.net/.../how-to-consume-rest-api-url-in-microsoft-d365-business-central-example-getting-data-from-jsonplaceholder-api

    And you can also visit my Youtube channel in which I have shown how to handle API Response....

    Just providing a method here for future reference:

    procedure UsersInfoFromResponse(response: Text): Boolean

       var

           responseArray: JsonArray;

           json_Token: JsonToken;

           json_Object: JsonObject;

           userInfo_JsonObject: JsonObject;

           i: Integer;

       begin    

           if json_Token.ReadFrom(response) then begin

               if json_Token.IsArray then   // json_Token.IsArray; json_Token.IsObject; json_Token.IsValue;

                   responseArray := json_Token.AsArray();

               for i := 0 to responseArray.Count() - 1 do begin

                   // Get First Array Result

                   responseArray.Get(i, json_Token);

                   // Convert JsonToken to JsonObject

                   if json_Token.IsObject then begin

                       userInfo_JsonObject := json_Token.AsObject();

                       insertUsersDetail(userInfo_JsonObject); // Call another procedure....

                   end;

               end;

           end;

           //end;

           exit(true);

       end;

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans