score:1

Accepted answer

Couple things wrong here.

First, while you are correct path creation is wrapped in a function and will execute after the php code but your svg creation will execute before the body tag, so you'll never get an svg tag.

Second, your JSON is malformed. I executed the php and it produces:

<script>
var root = {
  "name": "flare",
  "children": {
    "name": "first",
    "children": [{
      "name": "subchild1",
      "size": 90
    }, {
      "name": "subchild2",
      "size": 10
    }, {
      "name": "subchild3",
      "size": 55
    }, {
      "name": "subchild4",
      "size": 72
    }, {
      "name": "subchild5",
      "size": 60
    }]
  }
};
input_data(root);

Notice, that the first children is an object and not an array of objects.

Putting these two things together here.


Related Query

More Query from same tag