Module: Grape::Parser::Json

Defined in:
lib/grape/parser/json.rb

Class Method Summary collapse

Class Method Details

.call(object, _env) ⇒ Object



7
8
9
10
11
12
# File 'lib/grape/parser/json.rb', line 7

def call(object, _env)
  ::Grape::Json.load(object)
rescue ::Grape::Json::ParseError
  # handle JSON parsing errors via the rescue handlers or provide error message
  raise Grape::Exceptions::InvalidMessageBody.new('application/json')
end