convert output of add.php to json; check if parent is still a directory