Code: Select all
pref1 = '{"foo":true}'
pref2 = "{'foo':true}"
JSON.parse(pref1)
=> {foo: true}
JSON.parse(pref2)
=> VM2021:1 Uncaught SyntaxError: Expected property name or '}' in JSON at position 1 (line 1 column 2)
Vielen Dank
Code: Select all
pref1 = '{"foo":true}'
pref2 = "{'foo':true}"
JSON.parse(pref1)
=> {foo: true}
JSON.parse(pref2)
=> VM2021:1 Uncaught SyntaxError: Expected property name or '}' in JSON at position 1 (line 1 column 2)