there are various ressources on the web explaining how to serialize some C# object to a JSON string. I have been unable to get any of them to work with MonoTouch 3.2.4 though.
Alternatives I came across:
the System.Json Namespace
I am already successfully using the System.Json namespace to de-serialize data. Hence, for simplicity's sake, I'd prefer to stick to that if possible. Unfortunately, I have no idea how to serialize with it (or if it is even possible).System.Runtime.Serialization.Json.DataContractJsonSerializer
The System.Runtime.Serialization.Json namespace is not available in MonoTouch. I've read somewhere that it is part of .NET 3.5 and that MonoTouch is at .NET 2.0 level. That might explain it.System.Web.Script.Serialization.JavaScriptSerializer
This one is also missing in MonoTouch (in fact, there only seems to be System.Web.Services available).Json.NET by James Newton-King
I managed to make this one work on the simulator by including the .NET 2.0 assembly dll and using Newtonsoft.Json.JsonConvert.SerializeObject(). However, this doesn't compile for the device with error "mtouch failed with no output". As soon as I remove the assembly reference, it compiles fine.
Is there any way to make one of those work with MonoTouch? Are there other alternatives to try?
Thanks