creates a json tree from a directory structure