Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 807077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:20:53+00:00 2026-05-15T00:20:53+00:00

I get the following data back from my WCF Data Service (I cut out

  • 0

I get the following data back from my WCF Data Service (I cut out the metadata)

{
  "d": [{
      "CodeId": 6,
      "Title": "A Child Sub Item",
      "Parent":
    },
    {
      "CodeId": 5,
      "Title": "Another Root Item",
      "Parent": -1
    },
    {
      "CodeId": 4,
      "Title": "Child Item",
      "Parent": 2
    },
    {
      "CodeId": 2,
      "Title": "Root Item",
      "Parent": -1
    }
  ]
}

I am trying to get this into a <ul> style tree with Parent = -1 as root and then the rest as sub items of their parent id’s.

Can anyone help me please, preferably in jQuery? I will use this in jstree if someone knows of a better way to do this.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T00:20:53+00:00Added an answer on May 15, 2026 at 12:20 am
    1. Loop through those objects and convert them to the type jstree likes, while storing them in another object with CodeId as the key and the object as the value. Remember to preserve the Parent attribute
    2. Loop through the object you just created, and for each item:
      1. If it’s a root node, add it into a list
      2. If it’s not a root node, look up its parent from the object and add it to the parent’s child collection
    3. Feed the list you created in 3.1. into jstree
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get the following error when inserting data from mysql into postgres. Do I
I am following this example to get JSONP data from remote server. jQuery append
Whenever I want to get data from a plist file I use the following
I am using the following code to get an XML data from a website
I have a WCF service that passes back and forth the following DataContracts: [DataContract]
Using an ajax POST request in jQuery, I get the following xml back from
I'm using the wcf webapi to get data from my asp.net application, and trying
I have the following Data class: class CustomerProducts { public string Id { get;
I'm trying to call the SQL statement below but get the following error: System.Data.SqlClient.SqlException:
When user using the Settings' Clear Data button I get the following message: ActivityManager(201):

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.