LitJSON's JsonMapper.ToJson error: Max allowed object depth reached while trying to export from type
- by dev.e.loper
I have an object that I would like to convert to json inside one of the object's methods. I'm using LitJson library. Like so:
    protected override void Render(HtmlTextWriter writer)
{
    ...
    writer.AddAttribute(HtmlTextWriterAttribute.Value, JsonMapper.ToJson(this));
    ....
}
However JsonMapper.ToJson(this) produces a server error 
  "Max allowed object depth reached
  while trying to export from type
  System.Drawing.Color".
My guess is that because its trying to convert an object inside itself its going into some kind of infinite loop.  Just curious what is actually happening.