Module: JSON

Defined in:
lib/apollo_commons_ruby/TemplatesHelper.rb

Class Method Summary collapse

Class Method Details

.is_valid_json?(json) ⇒ Boolean

Returns:

  • (Boolean)


123
124
125
126
127
128
129
130
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 123

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