title: How to detect circular structures?
body: <p>For example, this code:</p>
  
  <pre><code>var a = {};
  a.a = a;
  JSON.stringify(a);
  </code></pre>
  
  <p>Will throw:</p>
  
  <pre><code>TypeError: Converting circular structure to JSON
  </code></pre>
  
  <p>My question is, how to detect a circular structure?</p>