Skip to content

Instantly share code, notes, and snippets.

@celldee
Created April 5, 2012 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save celldee/2313898 to your computer and use it in GitHub Desktop.
Save celldee/2313898 to your computer and use it in GitHub Desktop.
Handy JSON validation method
require 'json'
def valid_json?(str)
begin
JSON.parse(str)
return true
rescue Exception => e
return false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment