Ignoring a field during .NET JSON serialization; similar to [XmlIgnore]?

I use the ScriptIgnore attribute on my model like so:

public class Item
{
    [ScriptIgnore]
    public Item ParentItem { get; set; }
}

In this particular scenario I was getting a circular reference error from the Json serializer, so I simply ignored it. I was asking a similar question here on SO when I was turned on to the difference between a Model and ViewModel.

Leave a Comment