Code to extract from a CSV a tree datastructure, similar to a filesystem, and convert it to JSON string