Skip to content

Instantly share code, notes, and snippets.

@carlcrott
Created March 27, 2012 17:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save carlcrott/2218175 to your computer and use it in GitHub Desktop.
Save carlcrott/2218175 to your computer and use it in GitHub Desktop.
JSON validation method
class String
def valid_json?
begin
JSON.parse(self)
return true
rescue Exception => e
return false
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment