def ajax_request(func):
    @wraps(func)
    def wrapper(request, *args, **kwargs):
        response = func(request, *args, **kwargs)
        if isinstance(response, dict):
            return JsonResponse(response)
        else:
            return response
    return wrapper
If view returned serializable dict, returns JsonResponse with this dict as content.
dataset/ETHPy150Open splunk/splunk-webframework/server/splunkdj/decorators/render.py/ajax_request