Encode filenames to json