title: Using JSON.net, how do I prevent serializing properties of a derived class, when used in a base class context?
body: <p>Given a data model:</p>
  
  <pre><code>[DataContract]
  public class Parent
  {
      [DataMember]
      public IEnumerable&lt;ChildId&gt; Children { get; set; }
  }
  
  [DataContract]
  public class ChildId
  {
      [DataMember]
      public string Id { get; set; }
  }
  
  [DataContract]
  public class ChildDetail : ChildId
  {
      [DataMember]
      public string Name { get; set; }
  }
  </code></pre>
  
  <p>For implementation convenience reasons, there are times when the <code>ChildId</code> objects on the <code>Parent</code> are in fact <code>ChildDetail</code> objects.  When I use JSON.net to serialize the <code>Parent</code>, they are written out with all of the <code>ChildDetail</code> properties.</p>
  
  <p>Is there any way to instruct JSON.net (or any other JSON serializer, I'm not far enough into the project to be committed to one) to ignore derived class properties when serializing as a base class?</p>
  
  <p>EDIT: It is important that when I serialize the derived class directly that I'm able to produce all the properties. I only want to inhibit the polymorphism in the <code>Parent</code> object.</p>