ASP.NET MVC – How to Prevent JSON Serialization

asp.net-mvcjson

While developing an ASP.NET MVC app, I'm finding a few places where my JsonResult actions throw an exception "A circular reference was detected while serializing an object".

For now, I'm removing the references in question, but ideally I'd like to simply mark the property such that the JSON serializer ignores it.

Can anyone suggest how I might do this?

Best Answer

[ScriptIgnore] should work for you.