title: How To Fix Circular Reference Error When Dealing With Json
body: <p>This question is a part of my original post here <a href="https://stackoverflow.com/questions/12568363/how-to-get-data-into-an-extjs-grid-panel-using-json-and-sql">Get Data Into Extjs GridPanel</a></p>
  
  <p>Below is my Controller that reads data from sql db and then I am trying to encode the result as JSON and send the data back to my gridview.js</p>
  
  <pre><code>public JsonResult writeRecord()
  //public string writeRecord()
      {
  
          Response.Write("Survey Completed!");
          SqlConnection conn = DBTools.GetDBConnection("ApplicationServices2");
  
  
          string sqlquery = "SELECT Q1, Q2, Q3, Q4, Improvements, Comments FROM myTable";
          SqlDataAdapter cmd = new SqlDataAdapter(sqlquery, conn);
  
  
          DataSet myData = new DataSet();
          cmd.Fill(myData, "myTable");
  
          conn.Open();
          conn.Close();
  
          return Json(myData, JsonRequestBehavior.AllowGet);
          //return myData.GetXml();
  
      } 
  </code></pre>
  
  <p>Here lies the problem,
  with the above code, I get my gridview table with no data when executing gridview.js, but if I directly access my controller's method like this </p>
  
  <pre><code>http://localhost:55099/GridView/writeRecord
  </code></pre>
  
  <p>I get this error,</p>
  
  <blockquote>
    <p><em>A circular reference was detected while serializing an object of type 'System.Globalization.CultureInfo'.</em>
    <strong>Description:</strong> An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    <strong>Exception Details:</strong> System.InvalidOperationException: A circular reference was detected while serializing an object of type 'System.Globalization.CultureInfo'.</p>
  </blockquote>
  
  <p>Can someone please help..</p>