Error: Type of “status“ (number) is not supported. Use objects or arrays of objects.

请求JSON Server服务器数据报错

之前的json数据:


  "status": 200,
  "data": [
    {
      "image": "http://iwenwiki.com:3002/images/savefood1.jpg",

      "title": "123"
    },
    {
      "image": "http://iwenwiki.com:3002/images/savefood1.jpg",

      "title": "456"
    }

  ]

使用这个数据会报如下错:

意思是:在status后面不应该直接跟数字0而是应该跟一个Object对象或者是数组对象。

所以将数据修改后:

"status": {
    "status": 200
  },
  "data": [
    {
      "image": "http://iwenwiki.com:3002/images/savefood1.jpg",

      "title": "123"
    },
     {
      "image": "http://iwenwiki.com:3002/images/savefood1.jpg",

      "title": "456"
    }
  
  ]

猜你喜欢

转载自blog.csdn.net/m0_51744718/article/details/129128450