parse a directory to a tree with json format.