[mono-android] JsonObject.ToString() not escaping new lines.
Terry151151
Terry at Terry-Watts.com
Wed Jun 27 21:45:48 UTC 2012
I have a class that overrides ToString() to convert the class to a string.
Ie:
public override string ToString()
{
if( Id == -1 )
return "";
else
return Name + "\n" + Unit
+ "\n" + AddressLine1 + "\n" + AddressLine2 + "\n" + AddressLine3 +
"\n" + AddressLine4
+ "\n" + City + "\n" + State + "\n" + PostCode + "\n" + Country;
}
I then I add the string to a JsonObject .
JsonObject JObject = new JsonObject();
JObject.Add( "Address", TheClass.ToString() );
When I generate the Json string using JsonObject.ToString(). Ie:
string JsonString = JObject.ToString();
When the string is generated the new lines are just passed straight through
without being escaped, causing the receiving end to generate an error.
Does anybody know why this is happening?
Thanks in advance
Terry.
--
View this message in context: http://mono-for-android.1047100.n5.nabble.com/JsonObject-ToString-not-escaping-new-lines-tp5710632.html
Sent from the Mono for Android mailing list archive at Nabble.com.
More information about the Monodroid
mailing list