Skip to content

Instantly share code, notes, and snippets.

@erran
Last active December 23, 2015 00:58
Show Gist options
  • Save erran/6556862 to your computer and use it in GitHub Desktop.
Save erran/6556862 to your computer and use it in GitHub Desktop.
A script that validates the syntax of all of the JSON files in your CWD recursively. Run it by copying and pasting it into irb after you've cd'd into the correct directory.
#!/usr/bin/env ruby
# vi: set ft=ruby
require 'json'
Dir['**/*.json'].each do |json|
puts json
JSON.parse(File.read(json))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment