in optaplanner-docs/src/modules/ROOT/images/website/jstree/jstree.js [3757:3815]
get_json : function (obj, options, flat) {
obj = this.get_node(obj || $.jstree.root);
if(!obj) { return false; }
if(options && options.flat && !flat) { flat = []; }
var tmp = {
'id' : obj.id,
'text' : obj.text,
'icon' : this.get_icon(obj),
'li_attr' : $.extend(true, {}, obj.li_attr),
'a_attr' : $.extend(true, {}, obj.a_attr),
'state' : {},
'data' : options && options.no_data ? false : $.extend(true, $.isArray(obj.data)?[]:{}, obj.data)
//( this.get_node(obj, true).length ? this.get_node(obj, true).data() : obj.data ),
}, i, j;
if(options && options.flat) {
tmp.parent = obj.parent;
}
else {
tmp.children = [];
}
if(!options || !options.no_state) {
for(i in obj.state) {
if(obj.state.hasOwnProperty(i)) {
tmp.state[i] = obj.state[i];
}
}
} else {
delete tmp.state;
}
if(options && options.no_li_attr) {
delete tmp.li_attr;
}
if(options && options.no_a_attr) {
delete tmp.a_attr;
}
if(options && options.no_id) {
delete tmp.id;
if(tmp.li_attr && tmp.li_attr.id) {
delete tmp.li_attr.id;
}
if(tmp.a_attr && tmp.a_attr.id) {
delete tmp.a_attr.id;
}
}
if(options && options.flat && obj.id !== $.jstree.root) {
flat.push(tmp);
}
if(!options || !options.no_children) {
for(i = 0, j = obj.children.length; i < j; i++) {
if(options && options.flat) {
this.get_json(obj.children[i], options, flat);
}
else {
tmp.children.push(this.get_json(obj.children[i], options));
}
}
}
return options && options.flat ? flat : (obj.id === $.jstree.root ? tmp.children : tmp);
},