title: How to convert enclosed double quotes to single quotes in javascript?
body: <p>I am experiencing a very strange behavior of Javascript.</p>
  
  <p>I get the data object in the form of a string from the server as shown below,</p>
  
  <pre><code>"{'id':1234, 'name'}"
  </code></pre>
  
  <p>When I try to parse this data using JSON.parse() it throws</p>
  
  <pre><code>JSON.parse: expected property name or '}' at line 1 column 2 of the JSON data
  </code></pre>
  
  <p>However changing the data to <code>'{"id":1234, "name"}'</code> will work.</p>
  
  <p>But my question is how do I transform:</p>
  
  <pre><code>"{'id':1234, 'name'}" to '{"id":1234, "name"}' 
  </code></pre>
  
  <p>in the javascript end? (I dont want to change any thing in the server).</p>