Module: JSON

Defined in:
lib/apollo_commons_ruby/TemplatesHelper.rb

Class Method Summary collapse

Class Method Details

.is_valid_json?(json) ⇒ Boolean

Returns:

  • (Boolean)


167
168
169
170
171
172
173
174
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 167

def self.is_valid_json?(json)
  begin
    JSON.parse(json)
    return true
  rescue JSON::ParserError => e
    return false
  end
end