--- title: Load json data in javascript tree layout: page js: examples/load_json_data.js css: example.css ---

Example 1 - load json data

In this example we load the data using the data option. As you can see, the data is an array of objects.

{% highlight js %} var data = [ { name: 'node1', id: 1, children: [ { name: 'child1', id: 2 }, { name: 'child2', id: 3 } ] }, { name: 'node2', id: 4, children: [ { name: 'child3', id: 5 } ] } ]; $('#tree1').tree({ data: data }); {% endhighlight %}