Skip to main content

Bug Tracker

Side navigation

#13412 closed bug (duplicate)

Opened February 07, 2013 08:32PM UTC

Closed September 24, 2013 01:20PM UTC

parseJSON does not handle undefined in 1.9.1

Reported by: Owned by:
Priority: undecided Milestone: None
Component: ajax Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:

parseJSON has been clearly changed from 1.8.3 to 1.9.1. I have verified that 1.8.3 still handles undefined and returns null which is aligned with the documentation. The new version throws "Uncaught SyntaxError: Unexpected token u"

Attachments (0)
Change History (12)

Changed February 07, 2013 08:44PM UTC by dmethvin comment:1

resolution: → notabug
status: newclosed

JSON.parse(undefined) *should* be an error since it is invalid JSON. The request for docs fix is here:

Changed February 07, 2013 08:46PM UTC by dmethvin comment:2

BTW, the jQuery Migrate plugin identifies this. Please use the jQuery Migrate plugin. If you'd like you can submit a pull request to clarify the docs.

Changed February 07, 2013 10:16PM UTC by anonymous comment:3

I believe this is a poor decision, this is a case where purism creates an unnecessary burden. Plugins and javascript galore have relied on what is a documented behavior and this was not a bad thing. The validation check was in one centralized place. Now every bit of code by everyone else must do the check themselves.

I don't believe that the cost is worth it.

Changed February 17, 2013 07:24PM UTC by anonymous comment:4

just saying

if (!form.valid()) {

//alert("not valid");

return false;


will now fail with "Uncaught SyntaxError: Unexpected token u"

what is the correct way of writing the above then? as far as i

knew that was correct.... now

jquery validate 1.11.0

needs to be updated...or is this part of


Changed February 18, 2013 01:07AM UTC by dmethvin comment:5

Both of those are plugins, you'd need to ask the plugin author. The jQuery Migrate 1.1.1 plugin should allow the code to work as-is.

Changed February 22, 2013 11:32AM UTC by anonymous comment:6

Microsoft should not be writing plugins?? Kidding, they need to fix them though

Changed April 25, 2013 04:17PM UTC by comment:7

I also disagree with the decision to close this. I don't understand why it can't just do the 1.8.3 behavior.

Anonymous said it best: "I believe this is a poor decision, this is a case where purism creates an unnecessary burden." +1

Changed April 25, 2013 05:42PM UTC by dmethvin comment:8

Please use the jQuery Migrate plugin until any dependent code is fixed, that's why we wrote it. Remediations in your own code should be only a line or two.

Changed May 03, 2013 11:02AM UTC by anonymous comment:9

+1 for using the old behaviour, this is an unnecessary burden on me as a plugin user - especially since the plugin I have a problem with is not open source (nice one Microsoft). I also don't see why the old behaviour is problematic?

Changed May 09, 2013 03:17PM UTC by Bobby Tables comment:10

Although I feel similar to most here in that the parseJSON method should probably do some simple checking on the input before attempting to parse the JSON, this is equally an issue caused by Microsoft haphazardly tossing whatever they want into the parser and expecting gold.

I've submitted a bug report to Microsoft for this issue; you can see it at:

Maybe they will get around to fixing it in my lifetime...

Changed September 24, 2013 01:18PM UTC by gibson042 comment:11

resolution: notabug
status: closedreopened

Changed September 24, 2013 01:20PM UTC by gibson042 comment:12

component: unfiledajax
resolution: → duplicate
status: reopenedclosed

Duplicate of #13169.