title: Extract object from string in javascript
body: <p>I have this text as string in javascript:</p>
  
  <pre><code>'ConversationMessage.edit({"conversation_message_id":1901,"conversation_id":154,"resource_id":112,"message":"Great :)","sent_datetime":"2017-05-22T10:04:16.583Z","message_type":0,"display_name":"Hammad Rasheed","resource_image":"http://whuntulocal.s3.amazonaws.com/1492584389-Shot.png","messageattachment_id":null,"message_id":null,"directory_name":null,"filename":null})'
  </code></pre>
  
  <p>I want to extract the object from that. Meaning I want extract what was passed to <code>ConversationMessage.edit()</code> as parameter. </p>
  
  <p>I have tried <code>JSON.parse()</code> but that is failing. 
  I have tried to <code>str.split()</code> to split ")" and "(" character but that does not work either because the message property in the object can contain ")" string as well, as it is currently containing "Great :)".</p>
  
  <p>Here is the source of HTML where this string gets extracted: </p>
  
  <pre><code>&lt;span class="message-date text-navy"&gt;&lt;i class="fa fa-pencil text-success cursor-pointer message-edit-pencil" onclick="ConversationMessage.edit({&amp;quot;conversation_message_id&amp;quot;:1901,&amp;quot;conversation_id&amp;quot;:154,&amp;quot;resource_id&amp;quot;:112,&amp;quot;message&amp;quot;:&amp;quot;Great {{{{{{{&amp;quot;,&amp;quot;sent_datetime&amp;quot;:&amp;quot;2017-05-22T10:04:16.583Z&amp;quot;,&amp;quot;message_type&amp;quot;:0,&amp;quot;display_name&amp;quot;:&amp;quot;Hammad Rasheed&amp;quot;,&amp;quot;resource_image&amp;quot;:&amp;quot;http://whuntulocal.s3.amazonaws.com/1492584389-Shot.png&amp;quot;,&amp;quot;messageattachment_id&amp;quot;:null,&amp;quot;message_id&amp;quot;:null,&amp;quot;directory_name&amp;quot;:null,&amp;quot;filename&amp;quot;:null})"&gt;&lt;/i&gt; Monday, 22 May 2017, 15:04 &lt;/span&gt;
  </code></pre>