As demonstrated in this jsfiddle, if you have a JS file and you create a JSON object without using it, it behaves differently depending on whether the keys(members) are wrapped in quotes or not.

valid code:{ a: 1};
invalid code: { "a": 1 };

What you will get is an error message (in Chrome, different for FF/IE, but still fails on syntax)

Uncaught SyntaxError: Unexpected token :

but if you use the object in some way, for example: alert({ "a": 1 }); everything is OK again.

Why does this happen?

Edit
Report