title: Storing Objects in localStorage
body: <p>I have an array like this:</p>
  
  <pre><code>[{name:"test", time:"Date 2017-02-03T08:38:04.449Z"}]
  </code></pre>
  
  <p>I stored it in <code>localstorage</code> and when I retrieving data from <code>localstorage</code> I got the value:</p>
  
  <pre><code>[object, object]
  </code></pre>
  
  <p>How can I solve this issue?</p>
  
  <p><strong>config.ts</strong></p>
  
  <pre><code>import { Injectable } from "@angular/core";
  
  @Injectable()
  export class TokenManager {
  
    public tokenKey: string = 'app_token';
  
    constructor() { }    
  
    store(content) {
      var contentData;
  
      console.log("inside localstorsge store:", content);
      contentData = content.map(
        (data) =&gt; data.name
      )
      console.log("contentData:", contentData)
      localStorage.setItem(this.tokenKey, content);
    }
  
    retrieve() {
      console.log("inside localstorage");
      let storedToken: any = localStorage.getItem(this.tokenKey);
      console.log("storedToken:", storedToken);//====&gt; here this console is[object object]
      if (!storedToken) throw 'no token found';
      return storedToken;
    }
  
  }
  </code></pre>