title: Turning JSON strings into objects with methods
body: <p>I have an app that allows users to generate objects, and store them (in a MySQL table, as strings) for later use. The object could be :</p>
  
  <pre><code>function Obj() {
      this.label = "new object";
  }
  
  Obj.prototype.setLabel = function(newLabel) {
      this.label = newLabel;
  }
  </code></pre>
  
  <p>If I use JSON.stringify on this object, I will only get the information on <code>Obj.label</code> (the stringified object would be a string like <code>{label: "new object"}</code>. If I store this string, and want to allow my user to retrieve the object later, the <code>setLabel</code> method will be lost.</p>
  
  <p>So my question is: how can I re-instantiate the object, so that it keeps the properties stored thanks to JSON.stringify, but also gets back the different methods that should belong to its prototype. How would you do that ? I was thinking of something along "create a blank object" and "merge it with the stored one's properties", but I can't get it to work.</p>