Skip to content

Instantly share code, notes, and snippets.

@anilmujagic
Created March 15, 2013 22:57
Show Gist options
  • Save anilmujagic/5173812 to your computer and use it in GitHub Desktop.
Save anilmujagic/5173812 to your computer and use it in GitHub Desktop.
Serializing Exception to JSON using Json.NET and ServiceStack.Text
static void Main(string[] args)
{
try
{
var x = 1 / args.Length;
}
catch (Exception ex)
{
Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(ex));
Console.WriteLine();
Console.WriteLine(ServiceStack.Text.JsonSerializer.SerializeToString(ex));
Console.WriteLine();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment