title: Getting "Uncaught TypeError: Cannot set property 'container' of undefined" when trying to load stage from JSON
body: <p>Anytime I try to do Konva.Node.create, I get an error: &quot;Uncaught TypeError: Cannot set property 'container' of undefined&quot;. As far as I can tell, the data I am using is properly formatted JSON, saved to and then retrieved from a file after using toJSON on an initial stage. I would greatly appreciate any help in solving this. I have posted the console log of the data below, thanks!:</p>
  <pre><code>{
      &quot;attrs[width]&quot;: &quot;754&quot;,
      &quot;attrs[height]&quot;: &quot;647&quot;,
      &quot;className&quot;: &quot;Stage&quot;,
      &quot;children[0][className]&quot;: &quot;Layer&quot;,
      &quot;children[0][children][0][attrs][rotateEnabled]&quot;: &quot;false&quot;,
      &quot;children[0][children][0][attrs][enabledAnchors][]&quot;: [
          &quot;top-left&quot;,
          &quot;top-right&quot;,
          &quot;bottom-left&quot;,
          &quot;bottom-right&quot;,
      ],
      &quot;children[0][children][0][className]&quot;: &quot;Transformer&quot;,
      &quot;children[0][children][1][attrs][draggable]&quot;: &quot;true&quot;,
      &quot;children[0][children][1][attrs][id]&quot;: &quot;square1&quot;,
      &quot;children[0][children][1][className]&quot;: &quot;Group&quot;,
      &quot;children[0][children][1][children][0][attrs][x]&quot;: &quot;559&quot;,
      &quot;children[0][children][1][children][0][attrs][y]&quot;: &quot;342.5&quot;,
      &quot;children[0][children][1][children][0][attrs][name]&quot;: &quot;Square&quot;,
      &quot;children[0][children][1][children][0][attrs][width]&quot;: &quot;100&quot;,
      &quot;children[0][children][1][children][0][attrs][height]&quot;: &quot;100&quot;,
      &quot;children[0][children][1][children][0][attrs][fill]&quot;: &quot;white&quot;,
      &quot;children[0][children][1][children][0][attrs][stroke]&quot;: &quot;black&quot;,
      &quot;children[0][children][1][children][0][className]&quot;: &quot;Rect&quot;,
      &quot;children[0][children][1][children][1][attrs][name]&quot;: &quot;text&quot;,
      &quot;children[0][children][1][children][1][attrs][text]&quot;: &quot;Storage&quot;,
      &quot;children[0][children][1][children][1][attrs][align]&quot;: &quot;center&quot;,
      &quot;children[0][children][1][children][1][attrs][verticalAlign]&quot;: &quot;middle&quot;,
      &quot;children[0][children][1][children][1][attrs][x]&quot;: &quot;559&quot;,
      &quot;children[0][children][1][children][1][attrs][y]&quot;: &quot;382.5&quot;,
      &quot;children[0][children][1][children][1][attrs][fontSize]&quot;: &quot;15&quot;,
      &quot;children[0][children][1][children][1][attrs][width]&quot;: &quot;100&quot;,
      &quot;children[0][children][1][children][1][attrs][fill]&quot;: &quot;black&quot;,
      &quot;children[0][children][1][children][1][className]&quot;: &quot;Text&quot;,
  }
  </code></pre>
  <p>Here is the method loadStage that throws the error. I save the code to a JSON file, and retrieve it using node. It is then passed to the function here:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function loadStage(stage) {
      $.ajax({
          type: 'GET',
          //contentType: 'application/json',
          url: '/getstage',
          success: function (data) {
              console.log("'"+data+"'");
              if(data !== "")
              {
                  stage = Konva.Node.create(data, 'canvas');
              }
          }
      });
  }</code></pre>
  </div>
  </div>
  </p>
  <p>Here is the method that saves the code on update (when I add a new shape):</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function saveStage() {
      var json = stage.toJSON();
      $.ajax({
          type: 'POST',
          //contentType: 'application/json',
          data: JSON.parse(json),
          url: '/savestage',
          success: function (data) {
              
          }
      });
  }</code></pre>
  </div>
  </div>
  </p>
  <p>And the error message:</p>
  <pre><code>Uncaught TypeError: Cannot set property 'container' of undefined
      at Function.ct._createNode (konva.min.js:12)
      at Function.ct.create (konva.min.js:12)
      at Object.success (facilitytracker.js:46)
      at c (jquery.min.js:2)
      at Object.fireWith [as resolveWith] (jquery.min.js:2)
      at l (jquery.min.js:2)
      at XMLHttpRequest.&lt;anonymous&gt; (jquery.min.js:2)
  ct._createNode @ konva.min.js:12
  ct.create @ konva.min.js:12
  success @ facilitytracker.js:46
  c @ jquery.min.js:2
  fireWith @ jquery.min.js:2
  l @ jquery.min.js:2
  (anonymous) @ jquery.min.js:2
  load (async)
  send @ jquery.min.js:2
  ajax @ jquery.min.js:2
  loadStage @ facilitytracker.js:38
  (anonymous) @ facilitytracker.js:9
  e @ jquery.min.js:2
  t @ jquery.min.js:2
  setTimeout (async)
  (anonymous) @ jquery.min.js:2
  c @ jquery.min.js:2
  fireWith @ jquery.min.js:2
  fire @ jquery.min.js:2
  c @ jquery.min.js:2
  fireWith @ jquery.min.js:2
  ready @ jquery.min.js:2
  B @ jquery.min.js:2
  </code></pre>