JSFiddle - React, Tailwind, and code Playground
JavaScript
/*
required JSON screen shot with console : https://imgur.com/a/3HyI9
var simple_chart_config = {
chart: {
container: "#OrganiseChart-simple"
},
nodeStructure: {text:{name:"Root"},children:[{text:{name:"naresh"},children:[{text:{name:"rahul1"}},{text:{name:"rahul123"}},{text:{name:"kapil1"},children:[{text:{name:"priya12"},children:[{text:{name:"amit12"}}]}]}]},{text:{name:"roshan"}},{text:{name:"Seppl"}},{text:{name:"pankaj1910"}}]}
};
*/
/*
my try is giving me this result: https://imgur.com/a/D2vzV
//json from PHP
var json = '<?php echo json_encode($tree); ?>';
below is my php json when i am using echo to json_encode($tree) :
[{"text":{"name":"Root"},"children":[{"text":{"name":"naresh"},"children":[{"text":{"name":"rahul1"}},{"text":{"name":"rahul123"}},{"text":{"name":"kapil1"},"children":[{"text":{"name":"priya12"},"children":[{"text":{"name":"amit12"}}]}]}]},{"text":{"name":"roshan"}},{"text":{"name":"Seppl"}},{"text":{"name":"pankaj1910"}}]}] ;
*/
var myjson = [{
"text": {
"name": "Root"
},
"children": [{
"text": {
"name": "naresh"
},
"children": [{
"text": {
"name": "rahul1"
}
}, {
"text": {
"name": "rahul123"
}
}, {
"text": {
"name": "kapil1"
},
"children": [{
"text": {
"name": "priya12"
},
"children": [{
"text": {
"name": "amit12"
}
}]
}]
}]
}, {
"text": {
"name": "roshan"
}
}, {
"text": {
"name": "Seppl"
}
}, {
"text": {
"name": "pankaj1910"
}
}]
}];
var simple_chart_config = {
chart: {
container: "#OrganiseChart-simple"
},
nodeStructure: myjson
};
console.log(simple_chart_config);