title: How to configure the Json serializer, to allow Circular References in Azure Functions (V2)?
body: <p>Suppose, I have a object that has a sub property that references itself.</p>
  
  <pre><code>public class Person
  {
      public Person Parent { get; set; }
      public string Name { get; set; }
  
      public ObservableCollection&lt;Person&gt; Children { get; set; } = new ObservableCollection&lt;Person&gt;();
  }
  </code></pre>
  
  <p>When I try to return it, </p>
  
  <pre><code>var pp = new Person();
  pp.Name = "TONY";
  pp.Children.Add(new Person()
  {
       Parent = pp,
       Name = "ESTHER"
  });
  
  return new JsonResult(pp);
  </code></pre>
  
  <p>it comes truncated, some Exception happens while serializing it.</p>
  
  <pre><code>{"parent":null,"name":"TONY","children":[{
  </code></pre>
  
  <blockquote>
    <p>SyntaxError: JSON.parse: end of data while reading object contents at line 1 column 43 of the JSON data</p>
  </blockquote>
  
  <p>On ASP Net we could do this:</p>
  
  <pre><code>config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling 
       = Newtonsoft.Json.ReferenceLoopHandling.Serialize;     
  config.Formatters.JsonFormatter.SerializerSettings.PreserveReferencesHandling 
       = Newtonsoft.Json.PreserveReferencesHandling.Objects;
  </code></pre>
  
  <p><strong>How can I configure Azure Function Json Serializer, to allow it?</strong></p>