本文介绍了从Azure Functions HttpTrigger返回JArray的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从HttpTrigger类型的Azure函数返回JArray对象:
I'm trying to return JArray object from Azure Function of HttpTrigger type:
JArray a = JArray.Parse("[{\"reportId\": \"1111\",\"reportName\": \"AAAA\"}]");
return req.CreateResponse(HttpStatusCode.OK, a);
但是,由于某种原因,响应正文返回为:
However, for some reason, the response body returned as:
[{"reportId":[],"reportName":[]}]
我在做什么错了?
推荐答案
Azure函数要求您使用Newtonsoft.Json版本9.0.1,因为我们不支持绑定重定向.您的代码与Functions主机在同一进程中运行,这意味着您具有相同的绑定重定向.
Azure Functions requires that you use Newtonsoft.Json version 9.0.1, as we don't support binding redirects. Your code is running in the same process as the Functions host, which means you have the same binding redirects.
我们正在改善Visual Studio的体验,因此很明显,依赖项有严格的上限.
We're improving the Visual Studio experience so that it's clear that there's a strict upper bound on the dependency.
这篇关于从Azure Functions HttpTrigger返回JArray的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!