Class: WebMock::Util::JSON

Inherits:
Object
  • Object
show all
Defined in:
lib/webmock/util/json.rb

Defined Under Namespace

Classes: ParseError

Class Method Summary collapse

Class Method Details

.parse(json) ⇒ Object


13
14
15
16
17
18
# File 'lib/webmock/util/json.rb', line 13

def self.parse(json)
  yaml = unescape(convert_json_to_yaml(json))
  YAML.load(yaml)
rescue ArgumentError => e
  raise ParseError, "Invalid JSON string: #{yaml}, Error: #{e.inspect}"
end