score:1
Accepted answer
your problem is that the data.json file is not in the public folder. you have to move it there from your root folder. only files in the public folder can be accessed by domain.tld/file. also you have to specify the full file name:
let res = await fetch(`${server}/data.json`);
Source: stackoverflow.com
Related Query
- NextJS - Unexpected token < in JSON at position 0
- "SyntaxError: Unexpected token < in JSON at position 0"
- React Js: Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
- Module parse failed: Unexpected token m in JSON at position 0
- Network error: Unexpected token < in JSON at position 0 at new ApolloError
- Next.js:FetchError: invalid json response body Unexpected token < in JSON at position 0
- Fetching JSON returns error Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0 and status code 304: Not Modified
- How to fix “Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0” ERROR
- Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
- How to fix "Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0" ERROR
- I have an error with my jsconfig.json in react js says throw err Unexpected token } in JSON at position
- SyntaxError: Unexpected Token P in JSON at position 0 - Error in React.js app
- SyntaxError: Unexpected token m in JSON at position 0: Jest fails running tests all of a sudden
- VM1661:1 Uncaught (in promise) SyntaxError: Unexpected token s in JSON at position 0
- react : Unhandled Rejection (SyntaxError): Unexpected token < in JSON at position 0
- CANNOT POST /auth/is-verify - Unexpected token < in JSON at position 0
- Unexpected token i in JSON at position 6 - react redux app
- VM892:1 Uncaught SyntaxError: Unexpected token e in JSON at position 0
- Configure production environment in a create-react-app(SyntaxError: Unexpected token < in JSON at position 0)
- FetchError: invalid json response body at .. Unexpected token < in JSON at position 0
- Uncaught (in promise) Error: Network error: Unexpected token < in JSON at position 3
- Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0 while acess static files in node server
- Error while deploying Next.js on vercel: Unexpected token R in JSON at position 0
- SyntaxError: Unexpected token r in JSON at position 0 on reactjs login page
- How to solve this exception Unexpected token < in JSON at position 0?
- SyntaxError Unexpected token < in JSON at position 0 in react.js API navigation
- Unexpected token < in JSON at position 0 image upload issue
- Unexpected token u in JSON at position 0 at JSON.parse
- POST 400 (Bad Request) Unexpected token o in JSON at position 1
- fetch catch return Unexpected token U in JSON at position 0
More Query from same tag
- react router v5 to v6 nested route not working
- Web Api 2 call from axios
- Converting array to string fails in react render -Javascript/React
- Square popup is coming while refreshing the page or switching the router with loading gif
- javascript iframe set timer and check if loaded
- Using <a/> tag with a sticky navbar takes me to the wrong place
- Fetch tinymce editor content from database in reactjs frontend
- Populate Redux Reducer with Parameter Passed Via an Action
- Adding new row to ag-grid at the top of the grid react
- React router private route not getting props from state (e.g. authentication state)
- How to add an icon to the options in react-select?
- Correctly dispatching logout action redux-saga
- Trying to send data in the body of a Axios GET to use in Django backend, but print of request.body is empty
- Amcharts unable to cover full width
- How to get an element By ID inside React.Fragment?
- Hook requires data from another hook, but getting Error: Rendered more hooks than during the previous render
- Can I disable one of the tabs in the bottomtabnavigator? React Native
- Cant send a var to props in another component
- How to simulate mouse over event on a div using enzyme for testing a react application?
- Can we call a function from inside the setState hook function?
- Avoiding re-renders for sibling React components with array of state stored in parent
- SASS React.js Undefined Variable
- How to load a React Component in an existing jQuery application on jQuery click
- how should I build onClick action in my react component + Redux
- react-leaflet, markers re-render when the popup is opened/closed
- Getting a "this.setState is not a function" error
- Change the background color based on what the fixed div is currently over
- Could'nt return maped item inside jsx component
- Having issues making requests to an API using AJAX
- How to make the second request wait for the previous one and use its data?