Use a `JsonResponse` for that. It handles special characters escaping along with other nice features.