Traverses the filesystem and generates a JSON representation