Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

jQuery Treeview render JSON data

Posted on by 30

Hello all,

I am trying to parse the data from dynamics (XMLHttpRequest) using jQuery and this is the format it is providing me

@odata.etag: "W/"3016650""
createdon: "2019-03-19T14:10:53Z"
importsequencenumber: null
modifiedon: "2019-03-19T14:10:53Z"
msdyn_customerassetid: "82cdb8cd-504a-e911-a958-000d3a124c2c"
msdyn_latitude: null
msdyn_longitude: null
msdyn_name: "Child 1"
overriddencreatedon: null
statecode: 0

I would like to parse this data with Parent/Child relation on the following format to display a Treeview control in Dynamics.  Can someone please help me how to do this?  

var products = [{
    id: "1",
    text: "Stores",
    expanded: true,
    items: [{
        id: "1_1",
        text: "Super Mart of the West",
        expanded: true,
        items: [{
            id: "1_1_1",
            text: "Video Players",
            items: [{
                id: "1_1_1_1",
                text: "HD Video Player",
                price: 220
            }, {
                id: "1_1_1_2",
                text: "SuperHD Video Player",
                price: 270
            }]
        }, {
            id: "1_1_2",
            text: "Televisions",
            items: [{
                id: "1_1_2_1",
                text: "SuperLCD 42",
                price: 1200
            }, {
                id: "1_1_2_2",
                text: "SuperLED 42",
                price: 1450
            }, {
                id: "1_1_2_3",
                text: "SuperLED 50",
                price: 1600
            }, {
                id: "1_1_2_4",
                text: "SuperLCD 55",
                price: 1350
            }, {
                id: "1_1_2_5",
                text: "SuperLCD 70",
                price: 4000
            }]
        }

}];

*This post is locked for comments

  • VenkateshVM Profile Picture
    VenkateshVM 30 on at
    RE: jQuery Treeview render JSON data

    Any help on this would be appreciated.  

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans