[TIMOB-2614] JSON.stringify failing for droid
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:59:36.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.6.0 M05 |
Components | Android |
Labels | android, defect, release-1.6.0, reported-1.5.1 |
Reporter | Andreas sandberg |
Assignee | Don Thorp |
Created | 2011-04-15T03:24:48.000+0000 |
Updated | 2011-04-17T01:59:36.000+0000 |
Description
With droid on 1.5.1 the stringify function seems to be returning inconsistent results. Everything works as expected with iphone.
var r2 = JSON.stringify( {'0':'asf'} );
Ti.API.error("Rest data: " + r2);
//Rest data: {"0":null}
var r3 = JSON.stringify(['abc','def'] );
Ti.API.error("Rest data: " + r3);
//Rest data: ["abc", "def"]
var o = {'def':'abc'};
var r4 = JSON.stringify( o );
Ti.API.error("Rest data: " + r4);
//Rest data: {def
var user ='me';
var pass = 'mypass';
var enc = 'encoded';
var credentials = {'user_name':user,'password':pass,'encryption'
: enc};
var restData =
JSON.stringify({'0':credentials,'1':'mobile','2':{'name_value_list':{}}});
Ti.API.error("Rest data: " + restData);
//Rest data: {"2":null,"1":null,"0":null}
var credentials = {'user_name':user,'password':pass,'encryption'
: enc};
var tmp =
{'0':credentials,'1':'mobile','2':{'name_value_list':{}}};
var restData = JSON.stringify(tmp);
Ti.API.error("Rest data: " + restData);
//Rest data: {"2":null,"1":null,"0":null}
@Matt Will you create a unit test for this. It should apply to both platforms.
(from [4665727d92384c4144283c114a46268250f9ac87]) check both string and integer types from Rhino, fixing Object->KrollDict conversion and JSON conversion [#2614 state:fixed-in-qa]
https://github.com/appcelerator/titanium_mobile/commit/4665727d92384c4144283c114a46268250f9ac87"> https://github.com/appcelerator/titanium_mobile/commit/4665727d9238...
[INFO] Titanium SDK version: 1.6.0 (01/13/11 08:11 7ca73a3) G1 (1.6) em (2.1) and droid1 (2.2.1), added to qa tests