Skip to content

Instantly share code, notes, and snippets.

@pca2
Last active August 29, 2015 14:03
Show Gist options
  • Save pca2/c63bd5857f35df6cf006 to your computer and use it in GitHub Desktop.
Save pca2/c63bd5857f35df6cf006 to your computer and use it in GitHub Desktop.
Ruby JSON validator
#Borrowed from https://www.ruby-forum.com/topic/136579
require 'json'
def json_valid?(str)
JSON.parse(str)
return true
rescue JSON::ParserError
return false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment