You
My loop breaks on filenames containing spaces.
ChatGPT
Word splitting is doing exactly what it was told. Use null separators end to end:
find . -name '*.json' -print0 |
while IFS= read -r -d '' file; do
printf '%s\n' "$file"
done
The quotes around "$file" matter as much as the null delimiter; either one alone still breaks.
