title: Angular-6: Convert string to array of a custom object
body: <p>I have this produced <strong>string</strong>:</p>
  
  <pre><code>string str = [{"id":1,"name":"Angular"},{"id":2,"name":"SpringBoot"}]
  </code></pre>
  
  <p>I'd like to convert it to an <strong>array of Objects</strong> to have that:</p>
  
  <pre><code>listexps: Expertise[];
  listexps = [{"id":1,"name":"Angular"},{"id":2,"name":"SpringBoot"}];
  </code></pre>
  
  <p>And <strong>Expertise</strong> class is</p>
  
  <pre><code>export class Expertise
  {
      id: number;
      name: string;
  }
  </code></pre>
  
  <p>I tried that:</p>
  
  <pre><code>let array = str .replace('[{','').replace('}]','').split("},{").map(String);
  </code></pre>
  
  <p>but that didn't resolve my problem, I got:</p>
  
  <pre><code>"id":1,"name":"Angular","id":2,"name":"SpringBoot"
  </code></pre>
  
  <p>instead of</p>
  
  <pre><code>[{"id":1,"name":"Angular"},{"id":2,"name":"SpringBoot"}];
  </code></pre>
  
  <p>Have you please any idea about solving that ?.
  Big thanks.</p>