Serialization - grcodemonkey/iron_sharp GitHub Wiki
JSON
By default IronSharp uses the Newtonsoft.Json (http://james.newtonking.com/json) library for value serialization.
Defaults
IronSharp uses these JsonSerializerSettings by default:
return new JsonSerializerSettings
{
DefaultValueHandling = DefaultValueHandling.Ignore,
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
DateFormatHandling = DateFormatHandling.IsoDateFormat
};
To use the IronSharp default serializer in your code
JSON.Generate(new {a = "b"});
IValueSerializer
If you want to override the value serialization used by IronSharp, just implement your own IValueSerializer
IronMqRestClient ironMq = IronSharp.IronMQ.Client.New();
ironMq.Config.SharpConfig.ValueSerializer = new CustomValueSerializer();
IInspectable
All IronSharp Poco classes implement IInspectable
which allows them to be converted to their JSON representation by calling .Inspect()
(à la Ruby's inspect method)
var msg = queue.Next();
Console.WriteLine(msg.Inspect());