JSON Parse from LocalStorage error
<p>I am storing an object in localStorage using the following </p>

<pre><code>function onExit(){
   localStorage.setItem("my_object","'" + JSON.stringify(object) + "'");
 }
</code></pre>

<p>When logging this out of localStorage it looks like this</p>

<pre><code>'{"date":"2016-05-31T23:00:00.000Z","Name":"name","Code":"code","required":"false"}'
</code></pre>

<p>Now if I call JSON.parse on this directly it works, that is to say</p>

<pre><code>JSON.parse('{"date":"2016-05-31T23:00:00.000Z","Name":"name","Code":"code","required":"false"}')
</code></pre>

<p>will give me an object. But if I try</p>

<pre><code>JSON.parse(localStorage.my_object)
</code></pre>

<p>I get the 'unexpected character at line 1 of JSON data' error message</p>

<p>Where am I going wrong? Note: I have tried not enclosing the object in single quotes to no effect.</p>