Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save afrinjamanbd/5e98596514d59c7991893466a86666e4 to your computer and use it in GitHub Desktop.
Save afrinjamanbd/5e98596514d59c7991893466a86666e4 to your computer and use it in GitHub Desktop.
unexpected token ' in JSON at position while Json parsing
let a;
const x = `{
'quotes':
[
{
'id':1,
'quote':'Life isn’t about getting and having, it’s about giving and being.',
'author':'Kevin Kruse'
},
{
'id':2,
'quote':'Whatever the mind of man can conceive and believe, it can achieve.',
'author':'Napoleon Hill'
},
{
'id':3,
'quote':'Strive not to be a success, but rather to be of value.',
'author':'Albert Einstein'
},
{
'id':4,
'quote':'Two roads diverged in a wood, and I—I took the one less traveled by, And that has made all the difference.',
'author':'Robert Frost'
},
{
'id':5,
'quote':'I attribute my success to this: I never gave or took any excuse.',
'author':'Florence Nightingale'
}
]
}`
a = JSON.parse(x);
console.log(a);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment