Module: Grape::Parser::Json

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

Class Method Summary collapse

Class Method Details

.call(object, _env) ⇒ Object


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

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