Extract a json object from html string
<p>I'm stuck on a issue where i get a string from a web request containing html, but inside that html is a json object that i need to parse over to a object to use in my code but i'm stuck on how to do this.</p>

<p>I tried to use IndexOf() and LastIndexOf() but when i try to point them to the first and last curly braces i get a index of -1 and a exception.</p>

<p>Any ideas?</p>

<p>EDIT:
I have also tried to convert it to a list of characters and illitterate over it but when it got converted the curly braces were gone and the position was a empty entry.</p>

<p>EDIT2:</p>

<p>Added the html i get from the request, its lines 3-5 that i need to extract.</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
&lt;body onload="parent.postMessage('redirectResponse=
{"messageId":"4232450191","errorCode":0,"sessionToken":
{"sessionToken":"tRabFfRPwYX4fGdHZOrBYDAAoICwwCDo","issuerSystemId":"380","creationTime":
{"timestamp":"2016-02-11T08:58:30.000+00:00"},"expirationTime":
{"timestamp":"2016-02-11T09:03:30.000+00:00"},"maxIdlePeriod":0},
"realMode":1,"username":"myUserName"}
', 'https://target.site.com');"&gt;&lt;/body&gt;&lt;/html&gt;</code></pre>
</div>
</div>
</p>