1

The following throws "JavaScript runtime error: Invalid character":

   var opts = "[{'UOM':'E','Description':'E - Each'},{'UOM':'C','Description':'C - Per 100'},{'UOM':'M','Description':'M - Per 1000'}]"
   var options = JSON.parse(opts);

What invalid character is in my JSON string? Thanks

BoundForGlory
  • 3,981
  • 12
  • 47
  • 73

1 Answers1

3

You need to replace the apostrophes with escaped quotation marks (\").

Thriggle
  • 6,929
  • 2
  • 25
  • 37