Side navigation
#11762 closed bug (invalid)
Opened May 14, 2012 03:38AM UTC
Closed May 14, 2012 04:52AM UTC
Last modified May 18, 2012 08:41PM UTC
iPad 5.1.1 UIWebView - JSON.stringify cannot serialize cyclic structures.
Reported by: | bigred23z@gmail.com | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
iPad iOS 5.1.1 (UIWebView)
jQuery - 1.7.1
jQuery Mobile - 1.1.0
Phonegap - 1.7.0
I'm attempting to load a JSON object via a $.ajax call and am getting a weird error. It works fine on the iPad and iPhone simulators, but when testing on a real device I receive the following error (courtesy of $(document).ajaxError).
2012-05-13 20:21:12.955 Modeling[555:707] [INFO] TypeError: JSON.stringify cannot serialize cyclic structures. 2012-05-13 20:21:12.958 Modeling[555:707] [INFO] {"readyState":0,"responseText":"","status":0,"statusText":"error"} 2012-05-13 20:21:12.959 Modeling[555:707] [INFO] {"url":"...","isLocal":true,"global":true,"type":"GET","contentType":"application/json; charset=utf-8","processData":true,"async":true,"accepts":{"xml":"application/xml, text/xml","html":"text/html","text":"text/plain","json":"application/json, text/javascript","*":"*/*","script":"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},"contents":{"xml":{},"html":{},"json":{},"script":{}},"responseFields":{"xml":"responseXML","text":"responseText"},"converters":{"text html":true},"flatOptions":{"context":true,"url":true},"jsonp":"callback","cache":false,"dataType":"json","dataTypes":["text","json"],"crossDomain":true,"hasContent":false}
The call I am using is:
$.ajax({ cache: false, url: MyUrl, dataType: 'json', contentType: 'application/json; charset=utf-8', success: function (cities, textStatus, jqXHR) { } });
If it is truly an iOS issue, then I assume all devices running a Phonegap + jQuery + jQuery Mobile stack will fail on iOS 5.1.1.
Attachments (0)
Change History (5)
Changed May 14, 2012 04:52AM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
Changed May 15, 2012 01:23AM UTC by comment:2
I would like to see this ticket re-opened.
The example json file I am loading can be found at:
http://api.geonames.org/countryInfoJSON?formatted=true&lang=it&country=DE&username=demo&style=full
There is no cycles or references, so the error received does not pertain to the source.
Setup One (Successful):
- iPhone Simulator - iOS 5.1
- Cordova 1.7.0
- jQuery 1.7.1 (& 1.7.2)
Screenshot: http://i.imgur.com/MlFZ0.png
The source was retrieved using $.ajax successfully (response "success").
Setup One (Failure):
- Physical iPad 2 - iOS 5.1.1
- Cordova 1.7.0
- jQuery 1.7.1 (& 1.7.2)
Screenshot: http://i.imgur.com/e516V.png
The url was NOT successfully processed. An error of "JSON.stringify cannot serialize cyclic structures." is given.
Source code (example cordova index.html): https://gist.github.com/2698397
If you need any further details please let me know.
Changed May 15, 2012 01:35AM UTC by comment:3
Please provide a complete reduced test case on jsFiddle to help us assess your ticket. Be sure to test against the "jQuery (edge)" version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/
Open the link and click to "Fork" (in the top menu) to begin.
If this is a bug in jQuery, it will be reproducible without any of the other libraries or technologies present.
Changed May 18, 2012 11:48AM UTC by comment:4
I have the same problem using Phonegap 1.7.0, jquery mobile 1.1.0, jquery 1.7.1
Changed May 18, 2012 08:41PM UTC by comment:5
Test case can be found at: http://jsfiddle.net/mSDYA/1/
It appears to work with Safari on the iPad 2 - iOS 5.1.1 (theoretically the same rendering engine as UIWebView) "without any of the other libraries or technologies present". I don't see how Phonegap could be modifying native JSON libraries.. Perhaps iOS broke something with the 5.1 -> 5.1.1 patch.
I've opened an issue with Cordova (Phonegap). Hopefully they will reply
This neither a jQuery, iOS nor Phonegap issue. JSON.stringify cannot serialize objects that have cyclic structures or references as properties.