如何使用json服务器更新嵌套数组中对象的值?

时间:2019-04-15 07:38:11

标签: javascript json json-server

我有一个问题,到目前为止我无法解决。好吧,我创建了一个用于管理NES游戏锦标赛的应用程序,这里有一个模块,该模块带有一个表格,在球队赢得比赛后,我想对其进行更新。我想补充一点,我必须应用一个由两个数组组成的结构,因为它们每个都负责另一个锦标赛组:绿色和红色。我正在使用json服务器。我无法在附加结构中达到自己的价值。请求看起来应该如何更新,例如,一队的得分?哪个端点将允许您更新这些数组中包含的数据? PATCH不起作用,它返回404。在此先感谢您的帮助。

{"standings":[
  [{
     "id":"1", 
     "name":"Team1",
     "matches":0,
     "points":0,
     "gamesFor":0,
     "gamesAgainst":0
   }, {
     "id":"2", 
     "name":"Team2",
     "matches":0,
     "points":0,
     "gamesFor":0,
     "gamesAgainst":0
  }, {
     "id":"3", 
     "name":"Team3",
     "matches":0,
     "points":0,
     "gamesFor":0,
     "gamesAgainst":0
 }],[{
   "id":"1", 
   "name":"Team4",
   "matches":0,
   "points":0,
   "gamesFor":0,
   "gamesAgainst":0
 }, {
   "id":"2", 
   "name":"Team5",
   "matches":0,
   "points":0,
   "gamesFor":0,
   "gamesAgainst":0
 }, {
   "id":"3", 
   "name":"Team6",
   "matches":0,
   "points":0,
   "gamesFor":0,
   "gamesAgainst":0
 }] ]}

0 个答案:

没有答案