I have become a big fan of mustache.js recently for doing exactly this kind of thing.
http://github.com/janl/mustache.js/
Edit:
if I tweak calvinf's JSON format a little then this is an example using mustache.js:
<html>
<head>
<script type="text/javascript" src=" http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://github.com/janl/mustache.js/raw/master/mustache.js"></script>
<script type="text/javascript">
var topics = {
topics: [
{
title : "Topic 1",
items : [
{title: "1a", link: "http://www.example.com/", text: "Link Text or HTML"},
{title: "1b", link: "http://www.example.com/", text: "Link Text or HTML"}
]
},
{
title : "Topic 2",
items : [
{title: "2a", link: "http://www.example.com/", text: "Link Text or HTML"},
{title: "2b", link: "http://www.example.com/", text: "Link Text or HTML"}
]
}
]};
var template = "<ul>{{#topics}}<li>{{title}}<ul>{{#items}}<li id=\"foo_item{{title}}\"><a href=\"{{link}}\">{{text}}</a></li>{{/items}}</ul>{{/topics}}</ul>";
$(document).ready(function() {
$("#topics").html(Mustache.to_html(template, topics));
});
</script>
<title></title>
</head>
<body>
<div id="topics"></div>
</body>
</html>
If you want a speed benchmark for JavaScript templating libraries I found this link useful:
http://www.viget.com/extend/benchmarking-javascript-templating-libraries/