json:无法将对象解组为 []interface {} 类型的 Go 值

发布于 2025-01-14 13:32:20 字数 657 浏览 4 评论 0原文

我正在使用 krakend 和本地 Nodejs 服务器。

根据: 将KrakenD与本地nodejs服务器结合使用

我已经创建了krakend和nodejs服务器。它已启动并正在运行,并且 krakend 和 Nodejs 服务器之间的通信正在正常进行。但是,api 响应是 JSON,同时给出响应 krakend 打印

2022/03/15 02:54:06 KRAKEND ERROR: [ENDPOINT: /contacts] json: cannot unmarshal object into Go value of type []interface {}

虽然我已经在 krankend 中添加了标志 is_collection: "true" (如此处所示) https://github.com/luraproject/lura/issues/216

但仍然如此抛出同样的错误

I am using krakend and local nodejs server.

As per :
Using KrakenD with local nodejs server

I have created the krakend and nodejs server. It is up and Running and the communication between krakend and nodejs server is properly going on. But, the api response is JSON and while giving response krakend printing

2022/03/15 02:54:06 KRAKEND ERROR: [ENDPOINT: /contacts] json: cannot unmarshal object into Go value of type []interface {}

Although I have already added the flag is_collection: "true" in krankend (as shown here)
https://github.com/luraproject/lura/issues/216

But still it is throwing the same error

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半山落雨半山空 2025-01-21 13:32:20

我可以通过删除标志

"is_collection": "true",

并添加标志来

"encoding": "json"

完成它我不知道解析响应类型时出现什么问题,但我猜这是 Go build 或其他问题

I am able to get it done via removing the flag

"is_collection": "true",

and instead add the flag

"encoding": "json"

I don't know what is the issue while parsing the response type but I guess it an issue with Go build or something else

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文