title: Using anytree to convert JSON to a image
body: <p>I am trying to use anytree to read a JSON file and export it as a png image using render tree graph. For a basic example where I create the node it works.</p>
  
  <pre><code>from anytree import RenderTree
  from anytree import Node
  from anytree.dotexport import RenderTreeGraph
  
  root = Node("root")
  s0 = Node("s0", parent=root)
  s1 = Node("s1", parent=root)
  t1 = Node("t1", parent=s0)
  
  print(root)
  RenderTreeGraph(root).to_picture("test.png")
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/6ObV1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6ObV1.png" alt="Image generated by program"></a></p>
  
  <p>When I try importing a json file as per the <a href="https://anytree.readthedocs.io/en/latest/importer/jsonimporter.html" rel="nofollow noreferrer">docs</a></p>
  
  <pre><code>from anytree.importer import JsonImporter
  from anytree import RenderTree
  from anytree import Node
  from anytree.dotexport import RenderTreeGraph
  importer = JsonImporter()
  path = open("config.json")
  
  root = importer.read(path)
  tree = RenderTree(root)
  print(tree)
  
  RenderTreeGraph(tree).to_picture("test.png")
  </code></pre>
  
  <p>I get the following error:</p>
  
  <p><code>Traceback (most recent call last):
    File "pyth.py", line 20, in &lt;module&gt;
      DotExporter(tree).to_dotfile("tree.dot")
    File "/home/user/.local/lib/python3.5/site-packages/anytree/exporter/dotexporter.py", line 214, in to_dotfile
      for line in self:
    File "/home/user/.local/lib/python3.5/site-packages/anytree/exporter/dotexporter.py", line 160, in __iter
      for node in self.__iter_nodes(indent, nodenamefunc, nodeattrfunc):
    File "/home/user/.local/lib/python3.5/site-packages/anytree/exporter/dotexporter.py", line 174, in __iter_nodes
      nodename = nodenamefunc(node)
    File "/home/user/.local/lib/python3.5/site-packages/anytree/exporter/dotexporter.py", line 142, in __default_nodenamefunc
      return node.name
  AttributeError: 'RenderTree' object has no attribute 'name'</code></p>
  
  <p>Piping the <code>print(tree)</code> to a text file give the JSON as a text block without white space formatting, where as in the docs this needs to be done line by line to capture the tree structure. So it appears as though <code>RenderTree(root)</code> isn't formatting the JSON in the Node style of the first example.</p>
  
  <p>Does anyone know what is going wrong? Is there another step to correctly parse the JSON?</p>