Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#7521 closed bug (invalid)

1.4.4 - jQuery.parseJSON(string_with_only_whitespaces like ' ') throws an exception

Reported by: [email protected] Owned by:
Priority: undecided Milestone: 1.5
Component: unfiled Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:


I don't know whether this is expected behavior but jQuery 1.4.4 raises an exception when you try jQuery.parseJSON with a string which contains onyl whitespaces.

This occurs for example when you do a Ajax request (dataType: 'json') and the server returns just a string with one or more whitespaces.

I'm using Chrome 7.0.517.44 on ubuntu/linux so it uses the native parser (window.JSON.parse() )

Change History (4)

comment:2 Changed 12 years ago by jitter

Well just whitespace isn't a valid JSON response AFAIK

comment:3 Changed 12 years ago by dmethvin

Resolution: invalid
Status: newclosed

http://json.org/ indicates the minimal valid json is '{}'.

comment:4 Changed 12 years ago by anonymous

quite right, I'm taking this to the rails team, as this came up when using rails with ajax and json requests.

Thx for your help.

Note: See TracTickets for help on using tickets.