Uncaught (in promise) SyntaxError: Unexpected token ' in fetch function

Viewed 39557

I have a couple JSON files that are structured like this (let's call this info.json):

{
  'data': {
    'title': 'Job',
    'company': 'Company',
    'past': [
      'fulltime': [
        'Former Company'
      ],
      'intern': [
        'Women & IT',
        'Priority 5'
      ]
    ],
    'hobbies': [
      'playing guitar',
      'singing karaoke',
      'playing Minecraft',
    ]
  }
}

And in a separate JavaScript file, I have a function that looks like this:

function getJSONInfo() {
  fetch('info.json').then(function(response) {
    return response.json();
  }).then(function(j) {
    console.log(j);
  });
}

And I keep getting this error when I run getJSONInfo():

Uncaught (in promise) SyntaxError: Unexpected token '

What am I missing? I don't have a stray ' anywhere so I'm not sure what's wrong.

2 Answers
Related