繁体   English   中英

作为 [object Object] 进入服务器的对象数组

[英]Array of objects coming into server as [object Object]

我正在尝试将当前状态的属性作为(对象数组)发送到我的服务器。 当我尝试将它登录到我的服务器时,它以 [object Object] 数组的形式返回。 JSON.stringify 只在每个对象周围添加 ""。

 //sending my current players property to here getFantasyPros: function(players) { return axios.get("/api/scraper/" + players); }, //end point router.get("/:players", (req, res) => { const playerArr = JSON.stringify(req.params); console.log(playerArr); }

你需要通过你的回复(res)返回一些东西。 添加到端点的末尾。

return res.json({
  playerArr,
  msg: 'It worked'
})

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM