Last active
August 29, 2015 14:03
-
-
Save pca2/c63bd5857f35df6cf006 to your computer and use it in GitHub Desktop.
Ruby JSON validator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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