title: Transform a string of an object to an object
body: <p>I am trying to take an object from the server-side and bring it to an ejs file to use it in javascript.</p>
  <p>The object inside the javascript looks like this:</p>
  <pre><code>   var span = document.createElement(&quot;SPAN&quot;);
     span.innerHTML = &quot;&lt;%= JSON.stringify(positions) %&gt;&quot;;
     var positions = span.innerText;
     span.remove()
     console.log(positions)
  </code></pre>
  <p>and it returns a string like this one:</p>
  <pre><code>&quot;
      {
          '0': { foo: foo },
          '1': { foo: boo },
          '2': { foo: doo }
      }
      &quot;
  </code></pre>
  <p>Is there a way for me to do that?</p>
  <p>Thanks!</p>