Django does not set the cookie value to response headers when it return json data,so you need to set cookie value in response object manually. code like this:
@csrf_protect
def login_view(request):
if request.method == "GET":
response = HttpResponse(json.dumps(
{'username':request.user.username}
), mimetype='application/json')
response.set_cookie('hello','world')
return response