Trying to return some JSON code from the server so I can manipulate it within the JavaScript.
However i'm getting the following error:
Uncaught SyntaxError: Unexpected token m in JSON at position 10
Here is my code:
getJSON(url, success) {
      let query = [ 'cars', 'vans', 'bikes' ];
      var xhr = new XMLHttpRequest();
      xhr.onreadystatechange = function() {
        if (xhr.readyState === 4) {
          if (xhr.status === 200) {
            success(JSON.parse(xhr.responseText));
          } else {
            exit(xhr.responseText);
          }
        }
      };
      xhr.open('GET', url);
      xhr.send();
    }
This is the response I get if I just console.log the xhr.responseText:
[
  {
    make: 'VOLVO'
  },
  {
    make: 'AUDI'
  },
  {
    make: 'VOLKSWAGON'
  },
]
 
     
    