Class: Consul::Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/consul/util/utils.rb

Class Method Summary collapse

Class Method Details

.valid_json?(json) ⇒ Boolean

Public verify this is valid json

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
# File 'lib/consul/util/utils.rb', line 7

def self.valid_json?(json)
  begin
    JSON.parse(json)
    return true
  rescue Exception => e
    return false
  end
end