convert JSON to files and directories and back