Skip to content

Instantly share code, notes, and snippets.

@packmad
Created October 28, 2020 11:21
Show Gist options
  • Save packmad/1596cfaf9828bd90506dbcefbf200e09 to your computer and use it in GitHub Desktop.
Save packmad/1596cfaf9828bd90506dbcefbf200e09 to your computer and use it in GitHub Desktop.
Bash function that finds if a directory contains invalid JSON files
function check_valid_jsons_folder() {
if [ -d "$1" ]; then
find $1 -type f -iname "*json" | while read p; do if ! jq empty < $p > /dev/null 2>&1; then echo '> Invalid JSON: '$p; fi; done
else
echo "'$1' is not a directory!"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment