pzyryanov,
<script>
var menu = {
"item1.1": {
"item2.1": {
"item3.1": "#link3.1",
"item3.2": "#link3.2"
},
"item2.2": "#link2.2"
},
"item1.2": {
"item2.3": {
"item3.3": "#link3.3",
"item3.4": "#link3.4"
}
},
"item1.3": "#link1.3"
};
function build(list) {
var html = '', item, deep;
for (item in list) {
deep = typeof list[item] == 'object';
html += '<li><a href="' +(deep ? '#' : list[item])+ '">' +item+ '</a>' +(deep ? build(list[item]) : '')+ '</li>';
}
return '<ul>' + html + '</ul>';
}
document.write(build(menu));
</script>