Create a hierarchical tree JSON from a folder