module Roda::RodaPlugins::Json::RequestMethods

def convert_to_json(result)

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(result)
  opts = roda_class.opts
  serializer = opts[:json_result_serializer]
  if opts[:json_result_include_request]
    serializer.call(result, self)
  else
    serializer.call(result)
  end
end