require 'multi_json' module Sinatra::JSONHelpers def json(*args) args[0] = {} if args.size == 0 content_type (Rack.const_defined?('JSONR') and Rack::JSONR.is_jsonp_request?(request)) ? 'application/javascript' : :json MultiJson.dump args[0], :pretty => settings.respond_to?(:json_pretty) && settings.json_pretty end alias JSON json end