code: def json_response(func):
      
  
      @wraps(func)
      def wrapper(request, *args, **kwargs):
          res = func(request, *args, **kwargs)
          request.setHeader('Content-Type', 'application/json')
          return json.dumps(res)
  
      return wrapper
docs: @json_response decorator adds response header for content type,
      and json-dumps response object.
  
      Example usage:
  
          @json_response
          def test(request):
              return { "hello": "world" }