Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

JSON.stringify() differences between Android and iPhone

The following:

  var data = { 
    'user' : { 
      'email' : emailField.value, 
      'password' : passwordField.value 
    }
  };
  parsed = JSON2.stringify(data);

Yields different results between Android(1.6 and 2.1) and iPhone(3.1) simulators (Titanium mobile 1.0):

  • iPhone: parsed is: {"user":{"email":"asdf","password":"adsf"}}
  • Android: parsed is: {"user":"{"email":"asdf","password":"asdf"}"}

I found that if I included the json2.js reference code from json.org, the results are inline with the iPhone results.

Anyone have any idea why the two platforms would be so different?

— asked March 24th 2010 by Mitch Shields
  • android
  • iphone
  • json
0 Comments

0 Answers

The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.