module Roda::RodaPlugins::Json::RequestMethods

def block_result_body(result)

application/json content-type.
convert the result to json and return it as the body, using the
If the result is an instance of one of the json_result_classes,
def block_result_body(result)
  case result
  when *roda_class.json_result_classes
    response[CONTENT_TYPE] ||= roda_class.opts[:json_result_content_type]
    convert_to_json(result)
  else
    super
  end
end

def convert_to_json(obj)

but can use a custom serializer passed to the plugin.
Convert the given object to JSON. Uses to_json by default,
def convert_to_json(obj)
  args = [obj]
  args << self if roda_class.opts[:json_result_include_request]
  roda_class.opts[:json_result_serializer].call(*args)
end