module JSON

Public Class Methods

is_json?(text) click to toggle source
# File lib/ruby_cpu/core_ext/json/is_json.rb, line 2
def self.is_json?(text)
  begin
    return false unless text.is_a?(String)
    !!JSON.parse(text)
  rescue JSON::ParserError
    false
  end 
end