Skip to main content

Bug Tracker

Side navigation

#7106 closed bug (invalid)

Opened September 30, 2010 04:45PM UTC

Closed October 01, 2010 12:35AM UTC

Last modified March 15, 2012 12:30PM UTC

jQuery.parseJSON fails on Chrome

Reported by: lgpueyo Owned by:
Priority: low Milestone: 1.4.3
Component: misc Version: 1.4.2
Keywords: parseJSON, chrome Cc:
Blocked by: Blocking:
Description

When parsing the attached json with jQuery.parseJSON, a SyntaxException is raised under Chrome (6.0.472.63). Solution is to modify lines in jquery-1.4.2.js from 511:

<code>

return window.JSON && window.JSON.parse ?

window.JSON.parse( data ) :

(new Function("return " + data))();

</code>

with the following:

<code>

if ( window.JSON && window.JSON.parse ) {

try{return window.JSON.parse( data );}catch(e){return(new Function("return " + data))()}

} else {

return (new Function("return " + data))();

}

</code>

Cheers.

Attachments (1)
  • sample.json.zip (22.7 KB) - added by lgpueyo September 30, 2010 04:48PM UTC.
Change History (3)

Changed October 01, 2010 12:35AM UTC by snover comment:1

resolution: → invalid
status: newclosed

Thank you for the report, but this is not a bug. Your JSON is invalid, which is exactly what jQuery is telling you. Please use JSONLint. In the future, please use the jQuery Forum for support requests.

Changed February 20, 2011 08:47PM UTC by anonymous comment:2

it still not fixed in current verion ? Coz parsejson does not work in chromium.

Changed February 21, 2011 12:42AM UTC by jitter comment:3

cc: lgpueyo@gmail.com
component: unfiledmisc
priority: undecidedlow

Replying to [comment:2 anonymous]:

it still not fixed in current verion ? Coz parsejson does not work in chromium.

What is not fixed?? This ticket was invalid as the JSON was invalid.

--> How to report bugs