title: KineticJS Node.create from JSON object literal
body: <p>I've been trying to load a layer (gave up trying with a layer and started trying with the stage) that I saved as a JSON object literal with the KineticJS .toJSON() method. I've been debugging my script and everything seems to be fine until the Kinetic.Node.create is called. Here's my code:</p>
  
  <pre><code>var stage = new Kinetic.Stage({
      container: 'container',
      width: 1000,
      height: 650
    });
  var check;
  $(document).on({
  click: function(){
  
      check = stage.toJSON();
  
  }
  },'#save');
  
  $(document).on({
  click: function(){
      try{
         //parse check string into object literal
         var s = JSON.parse(check);
         //check if s is object literal
         if( Object.prototype.toString.call(s) === '[object Object]' ) {
  
              //this is where the code stops executing
              stage = Kinetic.Node.create(s,'container');
              stage.draw();
         }
      }
      catch(e){
          console.debug(e.stack);
          console.trace();
      }
  }
  },'#load');
  </code></pre>
  
  <p>My HTML:</p>
  
  <pre><code>&lt;div id="container"&gt;
  
  &lt;/div&gt;
  &lt;div id="buttons"&gt;
  &lt;button id="save"&gt;
      Save
  &lt;/button&gt; 
  &lt;button id="load"&gt;
      Load
  &lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And the error log:</p>
  
  <pre><code>SyntaxError: Unexpected token o
  at Object.parse (native)
  at Function.Kinetic.Node.create (http://d3lp1msu2r81bx.cloudfront.net/kjs/js/lib/kinetic-v4.5.4.min.js:2:25166)
  at HTMLButtonElement.$.on.click (http://localhost/mosaicos/main.js:181:38)
  at HTMLDocument.b.event.dispatch (http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js:3:28337)
  at HTMLDocument.v.handle (http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js:3:25042)
  </code></pre>
  
  <p>Not sure if I'm doing something wrong, any help would be greatly appreciated.</p>