I had a problem getting my browser to accept the data structure submitted by the OP, but here is a fully working example I've drawn up for my own, similar purposes. Beside the function I provide the data structure as well, with name/branches instead of title/folder.
<html>
<head>
<script>
function to_ul(branches) {
var ul = document.createElement("ul");
for (var i=0, n=branches.length; i<n; i++) {
var branch = branches[i];
var li = document.createElement("li");
var text = document.createTextNode(branch.name);
li.appendChild(text);
if (branch.branches) {
li.appendChild(to_ul(branch.branches));
}
ul.appendChild(li);
}
return ul;
}
function renderTree() {
var treeEl = document.getElementById("tree");
var treeObj = {"root": [{
"name": "George & Sarah Trede",
"branches": [{
"name": "George & Frances Trede",
"branches" : [{
"name": "Mary (Trede) Jempty"
},{
"name": "Carol (Trede) Moeller"
}]
},{
"name": "Mary (Trede) Sheehan"
},{
"name": "Ward Trede"
}]
}]};
treeEl.appendChild(to_ul(treeObj.root));
}
</script>
</head>
<body onload="renderTree()">
<div id="tree">
</body>
</html>