Convert json into tree structure using javascript, client side -


i want convert following json code have collected using requests tree structure

"rules": [{   "name": "rule1",   "isfirst": true,    "conditions": [{     "outcometrue": {       "gotorule": "rule2"     },     "outcomefalse": {       "changestatus": {         "gotorule": "26"       }     },     "outcomeerror": {       "changestatus": {         "gotorule": "27"       }     },   }], },{   "name": "rule2",   "isfirst": false,   "conditions": [{     "name": "history check idnumber",     "outcometrue": {         "gotorule": "27"     },     "outcomefalse": {       "gotorule": "rule3"     },     "outcomeerror": {       "gotorule": "26"     },    }], }] 

into this. normal graph this:

a tree graph structure

have @ d3.js' tree

live example

edit: example: d3.js tree diagram generated 'flat' data (uses array of objects)


Comments

Popular posts from this blog

c - CUDA code not processing if block properly -

amazon web services - The request could not be satisfied in while using <alphaNumeric-string>.cloudFront.net -

What is the `file` URI scheme in Puppet? -