A direct and simple way to build a tree from an Object :
Work fine like that but a shorter way would be better
a.k.a ~ $("#mytree").kendoTreeView({'ObjectSource':myObject)
try this html to have a better idea of what i suggest.
Thanks
<body>
<ul id="mytree"/>
<script>
$(document).ready(function() {
var myObject = { "who" : [ "french", "man", "old geek", { "age": "49", "status" : "with a wonderful wife" } ],
"living" : { "Europe" : { "France" : { "cities" : ["Paris","Bretagne"]}}},
"loving" : [{ "langages": ["KendoUI", "Node.js"]}, { "other" : "chocolate" }]
};
var ObjToHtmlUlLi = function (obj) {
var result = "";
if (obj instanceof Array)
for (i in obj)
result += "<li>" + ObjToHtmlUlLi(obj[i]) + "</li>";
else if (obj instanceof Object)
for(i in obj)
result += "<li>" + i + "<ul>"+ObjToHtmlUlLi(obj[i])+"</ul></li>";
else
result += "<li>"+ obj + "</li>";
return result;
};
$("#mytree").html(ObjToHtmlUlLi(myObject));
$("#mytree").kendoTreeView();
//=> somethins like $("#mytree").kendoTreeView({'jsonSource':myJsonObject) would be great
});
</script>
</body>