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

Announcements

No record found.

News and Announcements icon
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

  • Sangit Panchal Profile Picture
    45 on at

    Issue resolved.

  • Andy Sather Profile Picture
    Microsoft Employee 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
    793 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 569 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 375 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 228 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans