为了账号安全,请及时绑定邮箱和手机立即绑定

json.parse

json.parse

慕少森 2018-12-21 15:14:48
selectEportStatus (query) {      this.$http.get('/api/eport/wfas/eportDecl/selectAll', {        params: query      }).then((response) => {        if (response.data.status === 200) {          var result = response.data.result          if (result) {            result = JSON.parse(result)          }          console.log(result)          if (!result || !result.list) {            this.tableStatusData = []            this.tableDataTotal = 0          } else {            this.tableStatusData = result.list            this.tableDataTotal = parseInt(result.count)          }          if (this.tableDataTotal > 0) {            this.isShow = true          } else {            this.isShow = false          }        }      })    }目前的问题是在开发环境Json.parse没有报错 但是在测试环境报了这个错:Unexpected string in JSON at position 901 。相同的数据为什么会出现这种情况啊
查看完整描述

1 回答

?
胡子哥哥

TA贡献1825条经验 获得超6个赞

JSON.parse是字符串转对象,你这个传过来的确定是字符串吗


查看完整回答
反对 回复 2019-01-21
  • 1 回答
  • 0 关注
  • 489 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信