[Vuejs]-I am trying to load external JSON VueJS

0👍

Ur arrow function is not well defined, since you will be using variables from outside the direct scope of the function you should define its body, it cannot be inline as the response => response.json(), then you should write it like this

getSurveyData() {
  fetch('http://localhost:8081/survey.json')
    .then(response => response.json())
    .then(data => {
        this.surveyData = data
    }
  );
}

Leave a comment