Directory structure into JSON Python coding challenge

This is a solution of Python coding challenge from HackerEarth for Sportnana.com.

Problem statement

Given a directory structure, write a program to convert it into JSON format.

Solution

The solution is written in Python 3.10. The solution is in the file json-file-structure-v2.py. The solution is tested on Ubuntu Linux 22.04.1 LTS.

Usage

The solution is run from the command line. The directory structure is read from the standard input. The JSON output is written to the standard output. The solution is run as follows:

$ python3 json-file-structure-v2.py