Side navigation
#6267 closed bug (worksforme)
Opened March 11, 2010 02:10PM UTC
Closed March 11, 2010 02:53PM UTC
Last modified March 15, 2012 07:09PM UTC
parseJSON - plain boolean and integers
Reported by: | gregor | Owned by: | |
---|---|---|---|
Priority: | Milestone: | 1.4.3 | |
Component: | core | Version: | 1.4.2 |
Keywords: | json, parseJSON, true, integer | Cc: | |
Blocked by: | Blocking: |
Description
The code bellow should produce one success alert (for first item) and three alerts for failed attempts (last three items). But it ain't so: it produces success alerts for the last two items.
I searched the web and json.org and I couldn't find logical explanation, so I am filling this as a bug.
var a = new Array(); a[0] = '{ "fridge": "beer" }'; a[1] = "pizza"; a[2] = "true"; a[3] = "1"; for (var i = 0; i < a.length; i++) { try { var b = jQuery.parseJSON(a[i]); alert("Parsing \\"" + a[i] + "\\" was success."); } catch(e) { alert("Parsing \\"" + a[i] + "\\" failed."); } }
Attachments (0)
Change History (1)
Changed March 11, 2010 02:53PM UTC by comment:1
component: | unfiled → core |
---|---|
resolution: | → worksforme |
status: | new → closed |
This is matching the spec. Just try using the JSON parser provided by the browser:
It will alert out 'true'.