title: How do I return Json from Action Method with Array property?
body: <p>I am trying to return some data as json from an action method.</p>
  
  <p>I have an employee object that looks like this:</p>
  
  <pre><code>public class Employee
  {
       public int EmployeeID {get; set;}
       public string FirstName {get; set;}
       public string LastName {get; set;}
       //Other irrelevant properties
  }
  </code></pre>
  
  <p>Then I have a view model as follows</p>
  
  <pre><code>public Class EmployeeViewModel
  {
  
      public Employee Supervisor{get; set;}
      public List&lt;EmployeeViewModel&gt; Employees
  
  } 
  </code></pre>
  
  <p>I need to return a json object that looks exactly like this:</p>
  
  <pre><code>{id: 1, name: John, children: [
      {id: 1, name: Joe, children: []},
      {id: 1, name: Rob, children: []}
  ]}
  </code></pre>
  
  <p>For now I only need to go to the second level as above, returning and supervisor and their staff members beneath them.</p>
  
  <p>How would I go about returning this in my action method(I have the viewModel object hydrated already I just need to return it as json). My problem so far has been that the <code>children</code> property does not get populated.</p>