Serialize to JSON only if the CELERY_TASK_SERIALIZER is set to JSON in the config file.