Python 数据工厂中使用的 Azure 函数 returns:"Response Content is not a valid JObject"

Python Azure function used in Data Factory returns: "Response Content is not a valid JObject"

我在 Python 中创建了一个非常基本的 HTTP 触发器,我可以成功验证和测试它。但是,当我将其插入数据工厂时,无论我做什么,我都会收到消息:

Response Content is not a valid JObject

我尝试从 Azure Python 函数返回:

return func.HttpResponse(json.dumps(f"Hello Test!"), mimetype='application/json')

还有:

return json.dumps(f"Hello Test!")

但在这两种情况下,我总是收到无效的 JObject 错误消息。有什么想法吗?

你是不是写错了"f"

returnjson.dumps(f"Hello Test!")

您能否尝试将您的代码修改为

a = {'name': 'wang'}
json.dumps(a)