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.

html


<div id="tree1"></div>

javascript


var data = [
    {
        label: 'node1',
        children: [
            { label: 'child1' },
            { label: 'child2' }
        ]
    },
    {
        label: 'node2',
        children: [
            { label: 'child3' }
        ]
    }
];

$('#tree1').tree({
    data: data
});