added the method to dict and to json to render a json output on a tree

This pull request enable a Tree to be rendered as json or dict.