Side navigation
#7521 closed bug (invalid)
Opened November 15, 2010 12:58PM UTC
Closed November 15, 2010 02:03PM UTC
Last modified November 15, 2010 02:29PM UTC
1.4.4 - jQuery.parseJSON(string_with_only_whitespaces like ' ') throws an exception
Reported by: | christiaan.vandenpoel@gmail.com | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.5 |
Component: | unfiled | Version: | 1.4.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
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() )
Attachments (0)
Change History (4)
Changed November 15, 2010 01:04PM UTC by comment:1
Changed November 15, 2010 01:55PM UTC by comment:2
Well just whitespace isn't a valid JSON response AFAIK
Changed November 15, 2010 02:03PM UTC by comment:3
resolution: | → invalid |
---|---|
status: | new → closed |
http://json.org/ indicates the minimal valid json is '{}'.
Changed November 15, 2010 02:29PM UTC by comment:4
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.
added jsFiddle example http://jsfiddle.net/SYQvW/4/