Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

read out JSON node in Dynamics 365 Finance and Operations

(0) ShareShare
ReportReport
Posted on by 25
{
    "message": "SUCCESS",
    "status": 10001,
    "data": {
        "hostapplicationlocaldata_id": 118942,
        "transactiontype_id": 518,
        "hostapplicationkeyvalues": [
            {
                "key": "Invoice Number",
                "value": "Inv_1001"
            },
            {
                "key": "Invoice Description",
                "value": "Inv_desc_1001"
            },
            {
                "key": "Invoice Account",
                "value": "1001"
            },
            {
                "key": "Invoice Date",
                "value": "2020-09-16"
            }
        ],
        "canbeassociated": false,
        "showadddocumentpromptonsave": null,
        "showsidebysideentryprompt": null
    },
    "end_point": null,
    "timestamp": "637365283511395216",
    "error": []
}
While I'm consuming URL of 3rd Party, got response in JSON Node, need to use KEY and Value node value.
 
  • Yash Doshi Profile Picture
    25 on at
    RE: read out JSON node in Dynamics 365 Finance and Operations

    streamRead                  = new System.IO.StreamReader(dataStream);

    returnValue                  = streamRead.ReadToEnd();

    map                              = RetailCommonWebAPI::getMapFromJsonString(returnValue);

    mapEnumerator           = map.getEnumerator();

    while(mapEnumerator.moveNext())

    {

       switch (mapEnumerator.currentKey())

       {

           case "data":

               container1                  = mapEnumerator.currentValue();

               map1                        = Map::create(container1);

               hostApplicatioLocalDataId   = map1.lookup('hostapplicationlocaldata_id');

               //hostApplicationKeyValue     = map1.lookup('hostapplicationkeyvalues');

               //info(map2.lookup('hostapplicationlocaldata_id'));

       }

    }

    As I used map, I got the value of hostapplicationlocaldata_id which is in under the node of "data", Now I want to get HostApplicationKeyValue node's value which is a array.

  • Suggested answer
    Sukrut Parab Profile Picture
    71,682 Moderator on at
    RE: read out JSON node in Dynamics 365 Finance and Operations

    You can create a contract class  and utilize FormJsonSerializer::deserializeCollection method to get the values, you can refer example here or you can use RetailCommonWebAPI class to get values in a map as you have key and value and then read  values from map . You can use find references to look at the examples in standard code.

    Stream responsestr = httpWwebresponse.GetResponseStream();
                StreamReader reader = new System.IO.StreamReader(responsestr);
                map = RetailCommonWebAPI::getMapFromJsonString(reader.ReadToEnd());

  • Verified answer
    vinitgoyal2005 Profile Picture
    6,330 on at
    RE: read out JSON node in Dynamics 365 Finance and Operations

    Hi,

    Check community.dynamics.com/.../621319

    and  ariste.info/.../

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,923 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,788 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans