title: A circular reference was detected while serializing an object of type
body: <p>I tried this code in my controller :</p>
  
  <pre><code>List&lt;ProductListingModels&gt; prom = new List&lt;ProductListingModels&gt;();
  
  prom.Add(new ProductListingModels()
  {
      ID = item.ID,
      Name = item.Name,
      DepartmentID = item.DepartmentID.Value,
      BrandID = item.BrandID.Value
  });
  
  jr.Data = prom;
  jr.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
  return Json(new
  {
      ja = jr.Data,
  }, JsonRequestBehavior.AllowGet);
  </code></pre>
  
  <p>This is my ProductListingModel :</p>
  
  <pre><code> public class ProductListingModels:ItemEntityDataContext
   {
     public int ID { get; set; }
     public string Name { get; set; }
     public int DepartmentID { get; set; }
     public int BrandID { get; set; }
   }
  </code></pre>
  
  <p>It was an error :</p>
  
  <blockquote>
    <p>A circular reference was detected while serializing an object of type.</p>
  </blockquote>
  
  <p>But if I change from adding the object "prom" to adding something like string or integer, It works well. I don't know what problem happen of how to adding my objects.</p>
  
  <p>Can any one show me the solution. Welcome to all your question and answer, Thanks so much.</p>