Answer the question
In order to leave comments, you need to log in
How to load local json in vue?
Throws App.vue?234e:47 Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
at eval (App.vue?234e:45)
swears at " .then(response => response.json()) "
Checked all the ways
methods:{
fetchData(){
let url = '/store/api.json';
fetch( url, {
headers : {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
})
.then(response => response.json())
.then( json => {
console.log(json)
});
}
}
Answer the question
In order to leave comments, you need to log in
Most likely, you do not have a /store/api.json file on your server
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question