Bug Tracker

Modify

Ticket #6147 (closed bug: invalid)

Opened 3 years ago

Last modified 14 months ago

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

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

Description

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

Change History

comment:1 Changed 3 years ago by Skalman

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

comment:2 Changed 3 years ago by john

  • Status changed from new to closed
  • Resolution set to invalid
  • Component changed from unfiled to core

comment:3 Changed 14 months ago by anonymous

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().

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.