reopened → pending
I think our original goal was for
jQuery.parseJSON() to do the same things as the browser's
JSON.parse() method. This is what
SyntaxError: Unexpected token u
SyntaxError: Unexpected end of input
SyntaxError: Unexpected token N
The check for
data === null returns
null for a
null input, just like
JSON.parse(). Since the method is documented to receive a string, the other cases aren't in the domain of valid inputs in any case.
In other words, we're debating situations that aren't supposed to arise. Stop sending garbage to the method and it will stop complaining. If you call
jQuery.parseJSON(x) and are unsure whether
x is defined but want a
jQuery.parseJSON(x || null) instead. As a reader of the code I would prefer to see that in order to understand that
x may not be defined.
It appears vmonfrie may have jumped the ticket with an unrelated complaint in any case. The original report says the problem is that **JSON is undefined** in IE9 emulating IE7, which it is and our code accounts for that.
So we need a test case in jsFiddle.net that doesn't include other code and shows the problem. It sounds to me like some plugin is browser sniffing and possibly doing an incorrect shim of the
JSON object, but we would need a test case.