title: "Uncaught TypeError: Converting circular structure to JSON" -- Alternatives to JSON.stringify()?
body: <p>I am using a library, Instafeed, which creates a <code>feed</code> object. The <code>feed</code> object is pretty complex.</p>
  
  <p>I need to convert this object to a string value for transfer. </p>
  
  <p>Problem is, I'm getting the <code>Uncaught TypeError: Converting circular structure to JSON</code>. All of the answer I've come across say to alter the object to get rid of the circular reference. However, the object is pretty complex and I'd rather not have to do that.</p>
  
  <p>Is there any other way to serialize this object that would avoid the circular reference error?</p>
  
  <hr>
  
  <p>EDIT</p>
  
  <p>Actually, I'm looking at the object in the console and I see this:</p>
  
  <p><img src="https://i.stack.imgur.com/kcLuL.png" alt="enter image description here"></p>
  
  <p>I expanded the <code>context</code> key 30 times in total and it just kept going. I'm not having memory issues, and the feed does run fine as intended with the loading of the images as the only delay, so it doesn't seem like this library creating an infinite loop of nested elements.</p>
  
  <ul>
  <li><p>Is this just a peculiarity of how the object gets displayed and not indicative of the structure of the object itself?</p></li>
  <li><p>And how do I serialize something like this?</p></li>
  </ul>
  
  <hr>
  
  <p>ALSO, I tried a <a href="https://code.google.com/p/x2js/" rel="nofollow noreferrer">JSON-to-XML plugin</a> but on conversion with that I got the following error:</p>
  
  <pre><code>Uncaught RangeError: Maximum call stack size exceeded 
  </code></pre>