Class: WebMock::Util::Parsers::JSON

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

Class Method Summary collapse

Class Method Details

.parse(json) ⇒ Object



16
17
18
19
20
21
# File 'lib/webmock/util/parsers/json.rb', line 16

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