Is there any easy way to generate such a JSON? I found os.walk() and os.listdir(), so I may do recursive descending into directories and build a py
os.walk()
os.listdir()
On Linux, the command-line tool tree can be used, although it is not installed by default. The output is almost identical to that required by the OP, using the flag -J for JSON output (which can then be streamed to a file for example):
-J
tree -J folder
On OSX, this tool can be installed via Homebrew.