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