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

Announcements

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to iterate and get value from nested json array using RetailCommonWebAPI

(0) ShareShare
ReportReport
Posted on by 28
Hi All,
 
how to iterate this json and get the value of key1 and key2
 
{
  /statusCode/: /00/,
  /message/: /success/,
  /result/: {
    /key1/: /a/,
    /key2/: /b/
  }
}
 
Thanks
I have the same question (0)
  • Suggested answer
    Layan Jwei Profile Picture
    8,165 Super User 2026 Season 1 on at
    Hi it.dev,

    can you please show us the code. The contract for this json, and the line of code that returns this json?

    but in general, since you didn't share any code, then i will assume the json returned to you is a list (contractList), if that's the case, here's how u can get the value of key1 and key2
    ListEnumerator           retailWebAPIEnum;
    RetalWebAPIContract      contract;
    List resultsContractList;
    ListEnumerator resultContractEnum ;
    ResultsContract resultContract; if(contractList) // assume this is the list of json already returned to you { retailWebAPIEnum= contractList.getEnumerator(); if(retailWebAPIEnum) { while (retailWebAPIEnum.moveNext()) { contract = retailWebAPIEnum.current(); resultsContractList= contract.Results();
     
    if(resultsContractList.elements())
            {
                resultContractEnum = resultsContractList.getEnumerator();

            if(resultContractEnum)
            {
                while (resultContractEnum.moveNext())
                {
                    resultContract= resultContractEnum.current();
    resultContract.Key1(); resultContract.Key2();
      }
      }
      } } } }

    Thanks,
    Layan Jweihan

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 673 Super User 2026 Season 1

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 280 Super User 2026 Season 1

#3
Martin Dráb Profile Picture

Martin Dráb 213 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans