Skip to main content

Bug Tracker

Side navigation

#6147 closed bug (invalid)

Opened February 22, 2010 10:48AM UTC

Closed February 22, 2010 08:14PM UTC

Last modified April 20, 2012 09:27AM UTC

jQuery.parseJSON('{"name":NaN}'); handle failed

Reported by: xianke2009 Owned by:
Priority: Milestone: 1.4.2
Component: core Version: 1.4.1
Keywords: Cc:
Blocked by: Blocking:
Description

var obj = jQuery.parseJSON('{"name":NaN}');

var obj = jQuery.parseJSON('{"name":Infinity}');

var obj = jQuery.parseJSON('{"name":-Infinity}');

Attachments (0)
Change History (3)

Changed February 22, 2010 12:16PM UTC by Skalman comment:1

Infinity and NaN aren't valid JSON, see http://www.json.org/. Unfortunately there isn't a way to specify those values in JSON.

Changed February 22, 2010 08:14PM UTC by john comment:2

component: unfiledcore
resolution: → invalid
status: newclosed

Changed April 20, 2012 09:27AM UTC by anonymous comment:3

Why is it invalid JSON? The following statement is true:

typeof Infinity === "number"

So it adheres to the specification in my Eyes.

By the way: JSON-Strings with Infinity and NaN *can* be converted to objects via eval().