简体   繁体   English

Json 对象在 IE11 中未正确获取

[英]Json object not fetching properly in IE11

I am making an axios call to fetch a JSON object which works fine in Chrome and other browsers but in IE11 when i console the data key inside the object its fetching string that too half, so I am not able to convert it into JSON also from JSON.parse.我正在进行 axios 调用以获取 JSON 对象,该对象在 Chrome 和其他浏览器中运行良好,但在 IE11 中,当我控制台对象内部的数据键时,它获取的字符串太多了,所以我也无法将其转换为 JSON JSON.解析。

   axios.get("/bin/users")
      .then(response => {
          console.log('response',response);
        }
      ).catch(err => {
          console.log(err);
      }) 

This is the call i am making.这是我正在打的电话。 Inside response we have a data key which is actually an object.在响应内部,我们有一个数据键,它实际上是一个对象。 but its breaking into string that too in between in IE11 due to which when i am trying to access same data key in IE11 its throwing undefined error because am not able to access that key since it got converted to broken string and using JSON.parse also throws error because string is cut from in between in IE11但它在 IE11 中也进入了字符串,因此当我尝试在 IE11 中访问相同的数据键时,它会抛出未定义的错误,因为我无法访问该键,因为它被转换为损坏的字符串并使用 JSON.parse抛出错误,因为字符串在 IE11 之间被切断

就我而言,我必须添加Accept: 'application/json''Content-Type': 'application/json'标头,问题就解决了。

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

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