<!DOCTYPE html> <html> <head> <title></title> </head> <body> <script> var str = "{ 'foo': 'bar' }"; var json = JSON.parse(str); </script> </body> </html>
This code throws an error in the second expression of the variable. What for? (Chrome says “unexpected ILLEGAL token”, Firefox says “JSON.parse”)
source share