Answers for "VM724:1 Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0"

4

VM724:1 Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0

// if your json data doesn't show then just replace this code. 
handleGetJson = () =>{
  fetch(`./data.json`, {
      headers : { 
        'Content-Type': 'application/json',
        'Accept': 'application/json'
       }
    })
     .then(res=> res.json())
     .then(data=> console.log(data))
}
Posted by: Guest on October-14-2021
6

Uncaught (in promise) SyntaxError: Unexpected token O in JSON at position 0

var stringified = JSON.stringify(data);
var parsedObj = JSON.parse(stringified);
 
console.log(parsedObj);
Posted by: Guest on December-30-2020

Code answers related to "VM724:1 Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0"

Code answers related to "Javascript"

Browse Popular Code Answers by Language