title: JSON from localstorage not able to decode in php
body: <p>I am fetching values from localstorage as JSON and trying to decode.
  But its not working.</p>
  
  <p>This my code to fetch JSON from localstorage:</p>
  
  <pre><code>$items = "&lt;script&gt; document.write(JSON.parse(JSON.stringify(localStorage.getItem('itemList')))); &lt;/script&gt;";
  </code></pre>
  
  <p>When i echoed above <code>$items</code> it resulted like this:</p>
  
  <pre><code>{"items":[{"name":"Guitar","id":"1"}]}
  </code></pre>
  
  <p>Decoding above json like this:</p>
  
  <pre><code>$decoded = json_decode($items, true);
  </code></pre>
  
  <p>When i am trying to echo <code>$decoded</code> not displaying anything. When i did <code>var_dump($decoded)</code> its showing <code>NULL</code></p>
  
  <p>Any help is appreciated. Thank you.</p>