DEV Community

Paul C. Ishaili
Paul C. Ishaili

Posted on

Unexpected token < in json at position 0 fetch api

This error occurred when trying to fetch a local json file:


How I fixed this.

solution to Unexpected token < in json at position 0 fetch apimrpaulishaili

Put the json data file (or folder containing the json data files) in the public directory of your react project and try to fecth again.


Further Reading

https://stackoverflow.com/questions/37269808/react-js-uncaught-in-promise-syntaxerror-unexpected-token-in-json-at-posit

https://docs.microsoft.com/answers/questions/449617/syntaxerror-unexpected-token-lt-in-json-at-positio.html

Top comments (0)