have you seen serialize-list plugin ?
thank you for downvotes :P
function jsonify() {
var $this = $(this);
return {
id: $this.attr('id'),
children: $this.find('ul > li').map(jsonify).get()
};
}
$('#json').click(function(){
var json_list = $('#tree > ul > li').map(jsonify).get();
console.log(JSON.stringify(json_list));
});
this is working for me, but not with that tree plugin, because it changes DOM !