-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fetch res.json() SyntaxError: Unexpected token in JSON at position 0 #26523
Comments
res.text() can work, but JSON.parse() for after res.text(), also not work. |
Have you confirmed the response status is 200? Try using the code from https://developers.google.com/web/updates/2015/03/introduction-to-fetch#fetch and see if that prints it out |
response status is 200, but response header not status 200, is this reason? |
Not sure, however i believe its an issue with fetch you're having, not an issue with react-native |
This error is not related to fetch or react-native i think. Print the raw body text from the response and check if you can parse it to json in chrome dev tools. Most probably the issue is due to response body not in proper format to parse to json. |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information. |
React Native version: 0.60.5 and 0.59.3
Steps To Reproduce
Describe what you expected to happen:
res.json() work.
Snack, code example, screenshot, or link to a repository:
The text was updated successfully, but these errors were encountered: