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 :
Finance | Project Operations, Human Resources, ...
Answered

Iterate Jobject jarray in D365

(0) ShareShare
ReportReport
Posted on by 85

Please help me to iterate Jobject Jarray in X++. Below is the Json Iam converting it in jobject in D365 now want order_Items list in D365

{
"order": {
"store_id": 1,
"customer_id": 15680,
"order_items": [
{
"product_attributes": [],
"attribute_description": "Color: Black<br />Size: 24x24x2<br />Style: Beveled",
"product_id": 6930
},
{
"product_attributes": [],
"attribute_description": "Color: Black<br />Size: 24x24x2<br />Style: Beveled",
"product_id": 6931
}
]

}
}

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,978 Most Valuable Professional on at

    Please always use Insert > Insert Code (in the rich-formatting view) to paste source code. Isn't it better now?

    {
    	"order": {
    		"store_id": 1,
    		"customer_id": 15680,
    		"order_items": [
    			{
    				"product_attributes": [],
    				"attribute_description": "Color: Black
    Size: 24x24x2
    Style: Beveled", "product_id": 6930 }, { "product_attributes": [], "attribute_description": "Color: Black
    Size: 24x24x2
    Style: Beveled", "product_id": 6931 } ] } }

    I assume you mean JObject class from Newtonsoft.Json namespace.

    Calling GetValue("order_item").Children() should give you a collection of JTokens representing the items. You can call GetEnumerator() to get an enumerator; use its MoveNext() method to iterate it and its Current property to get indivual objects.

  • Suggested answer
    vinitgoyal2005 Profile Picture
    6,332 on at

    Hi,

    Check this blog: ariste.info/.../

  • Martin Dráb Profile Picture
    237,978 Most Valuable Professional on at

    I would also generate classes and deserialize JSON to an object graph, nevertheless using JObject is valid too.

  • Pupadhyay Profile Picture
    85 on at

    Thank you Martin

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 449 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 422 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans