title: Convert string in JSON
body: <p>Hey I would like to transform this string into JSON:</p>
  
  <pre><code>var newPart = '{\'' + name + '\': {\'content-type\' : ' +  type + ', \'content\': ' + content +  ',\'type\': \'content\'}}';
  </code></pre>
  
  <p>The result gives the following string: </p>
  
  <pre><code>{'partHtml': {'content-type' : text/html, 'content': dfg,'type': 'content'}}
  </code></pre>
  
  <p>I would like to get a JSON object from this string, i tried the following but it fails with the error : <strong>"SyntaxError: Unexpected token '"</strong></p>
  
  <pre><code>newPart = JSON.parse(newPart);
  </code></pre>
  
  <p>I tried without the ' with a few changes but the problem persists.</p>
  
  <p>Thank you for your help.</p>