import json from django.http import HttpResponse def call_method(request, method_name): tmp = {} for key in request.GET: tmp[key] = request.GET[key] response = HttpResponse(json.dumps({"response": {"method": method_name, "params": tmp}}, ensure_ascii=True)) response.headers["Content-type"] = "application/json" return response