This sample uses Argon.JRaw properties to serialize JSON with raw content.
public class JavaScriptSettings
{
public JRaw OnLoadFunction { get; set; }
public JRaw OnUnloadFunction { get; set; }
}var settings = new JavaScriptSettings
{
OnLoadFunction = [with("OnLoad")],
OnUnloadFunction = [with("function(e) { alert(e); }")]
};
var json = JsonConvert.SerializeObject(settings, Formatting.Indented);
Console.WriteLine(json);
// {
// "OnLoadFunction": OnLoad,
// "OnUnloadFunction": function(e) { alert(e); }
// }