title: Can I somehow save circular data structures with JSON or something similar?
body: <p>When trying to save some data about the game world in a file using JSON, I get that good ol' JSON circular reference error. Is there a way to save circular data types? Also, I'm running this with node.js, not inside a browser.</p>
  
  <p>Basically, over time, the player gets some units. These units are saved to a list inside the player object, but are given the player himself as an argument, so they know who's their owner. Something like this:</p>
  
  <pre><code>Player = function()
  {
      this.power = 0
      this.units = [new Unit(this)];
  }
  
  Unit = function(owner)
  {
      owner.power++;   
  }
  </code></pre>