简体   繁体   中英

React - Unexpected token u in JSON at position 5

I'm retrieving data from s3 , I have set the content type as "application/json" for the file. The call is successful. In the network --> response tab i see data as

{
  user: "test"
}

在此处输入图片说明

When i call the response.json() , I am getting below Error

index.js:1 SyntaxError: Unexpected token u in JSON at position 5

The problem is exactly what the error message says. That isn't valid JSON.

JSON requires quoted keys :

{
  "user": "test"
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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