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 = new("OnLoad"),
OnUnloadFunction = new("function(e) { alert(e); }")
};
var json = JsonConvert.SerializeObject(settings, Formatting.Indented);
Console.WriteLine(json);
// {
// "OnLoadFunction": OnLoad,
// "OnUnloadFunction": function(e) { alert(e); }
// }