code: def json_response(request, data):
      
      data["messages"] = []
      for msg in messages.get_messages(request):
          data["messages"].append({'message': msg.message, 'level': msg.level_tag})
      return HttpResponse(json.dumps(data), content_type="application/json")
docs: Wrapper dumping `data` to a json and sending it to the user with an HttpResponse
  
          :param django.http.HttpRequest request: The request object used to generate this response.
          :param dict data: The python dictionnary to return as a json
          :return: The content of ``data`` serialized in json
          :rtype: django.http.HttpResponse