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 8140223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:05:28+00:00 2026-06-06T12:05:28+00:00

For a json data as below is there any possible way to construct a

  • 0

For a json data as below is there any possible way to construct a treeview consisting of underscore.js templates. I don’t have lightest knowledge on how to mix functions, recursions into underscore.js templating functionality. I don’t have the power to produce json hierarchy from the server( it is decided by upper management).

[{
    name: "Home",
    url: "index.html",
    id: 1,
    parentid: 0
}, {
    name: "Company",
    url: "company.html",
    id: 2,
    parentid: 0
}, {
    name: "AboutsUs",
    url: "aboutus.html",
    id: 3,
    parentid: 2
}]

Expected View output

<ul>
    <li>
        <a href="index.html">Home</a>
    </li>
    <li>
        <a href="company.html">Company</a>
        <ul>  
            <li>
                <a href="aboutus.html">AboutUs</a>
            </li>
        </ul>
    </li>
</ul>
  • 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-06-06T12:05:29+00:00Added an answer on June 6, 2026 at 12:05 pm

    yes you can,
    you can use

    <% %>
    

    to write javascript code.

    <ul>
        <% _(your_data).each(function(param) { %>
    
            <li><%= param.name%></li>
            <!-- more code -->
        <% }); %>
    </ul>
    

    more here http://documentcloud.github.com/underscore/#template

    hope it helps,
    Good Luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need to parse the JSON data given below. {result:[{bookId:142645,bookpb:MF, bookTs:1328999630000,clipStatus:D,bookDetail:{arrival:1,purchase:1,sold:1}, hierarchies:{categories:[4],events:[]},shopId:769752}, upto sold
I ve data in the JSON format given below,need to populate the slick grid
using the below code for decoding json $categories = json_decode($data); $categories = $categories->data; where
I have a JSON data like this: { hello: { first:firstvalue, second:secondvalue }, hello2:
I use json data with jquery... I have filepaths in json and i am
I have the following JSON data being returned, but for some reason, Javascript or
Question: The JavaScript code below: records is JSON serialized data. I can access it
I have the code as per below. This retrieves some data to use for
I have the below Json (wf.json) { workflow:{ template:Analysis1, start:{ instance:HDA_run1, user:symtest, date:3-Mar-2012, timestamp:1330948220475
How to convert MySQL data base table into JSON data using PHP. Is there

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.