Module: APIMatchers::Core::Parser

Included in:
ResponseBody::HaveJson, ResponseBody::HaveJsonNode
Defined in:
lib/api_matchers/core/parser.rb

Instance Method Summary collapse

Instance Method Details

#jsonObject



4
5
6
7
8
# File 'lib/api_matchers/core/parser.rb', line 4

def json
  JSON.parse(response_body)
rescue JSON::ParserError => exception
  raise ::APIMatchers::InvalidJSON.new("Invalid JSON: '#{response_body}'")
end