title: Serializing only some properties of parent and children to JSON
body: <p>Supposed I have two classes like this:</p>
  
  <pre><code>public class Parent
  {
      public string Id { get; set; }
      public string Name { get; set; }
      public string Address { get; set; }
      public IList&lt;Child&gt; Children { get; set; }
      ...
  }
  
  public class Child
  {
      public string Id { get; set; }
      public string Name { get; set; }
      public string Gender { get; set; }
      public string Age { get; set; }
      ...
  }
  </code></pre>
  
  <p>If I want to serialize some properties of Parent I can do like this:</p>
  
  <pre><code>var data = GetListOfParents();
  return Json(data.Select(x =&gt; new { x.Id, x.Name}));
  </code></pre>
  
  <p>If I want to get the list of parents as above but each Parent contains one list of Children with selected properties like <code>Id</code> and <code>Name</code> only, what is the proper way to do it?</p>
  
  <p>I don't want to use <code>[ScriptIgnore]</code> because my entities contain a lot of Properties.</p>
  
  <p>Thank you</p>