title: How to properly decode a JSON string encoded using Html.Raw(Json.Encode(Model))?
body: <p>I am encoding some model data into a html element like this:</p>
  
  <pre><code>@Html.Raw(Json.Encode(Model));
  </code></pre>
  
  <p>The json string returned looks like this:</p>
  
  <pre><code>{"TestList":[{"FrequencyType":"1X","GCDs":"585.6","Identifier":"6144","SeqNo":9306,"SeqNoSpecified":true,"TSeqNo":8314,"TSeqNoSpecified":true,"TestDescr":"HBsAg"},{"FrequencyType":"1X","GCDs":"585.6","Identifier":"6124","SeqNo":9295,"SeqNoSpecified":true,"TSeqNo":8315,"TSeqNoSpecified":true,"TestDescr":"HCV Ab"},{"FrequencyType":"1X","GCDs":"585.3","Identifier":"6","SeqNo":9729,"SeqNoSpecified":true,"TSeqNo":8309,"TSeqNoSpecified":true,"TestDescr":"HD Monthly LS"}],"Frequency":[{"Key":"ANNUAL","Value":"Annually"},{"Key":"BIMONTH","Value":"Bi-Monthly"},{"Key":"BIWEEK","Value":"Bi-Weekly"},{"Key":"MON","Value":"Monthly"},{"Key":"1X","Value":"One Time"},{"Key":"QTR","Value":"Quarterly"},{"Key":"SMAN","Value":"Semi-Annual"},{"Key":"WEEK","Value":"Weekly"}]};
  </code></pre>
  
  <p>When I try to parse this using <code>JSON.parse</code>, I get an error:</p>
  
  <pre><code>arrayTestList = [];
  var jsonTestList = $('#TestList').text();
  jsonTestList = JSON.stringify(jsonTestList);
  arrayTestList = JSON.parse(jsonTestList);
  alert(arrayTestList.TestList[0]); // &lt;===== this line is failing
  
  Unable to get value of the property '0': object is null or undefined
  </code></pre>
  
  <p>How do I convert this <code>jsonTestList</code> string into a javascript array so that I can access elements of <code>arrayTestList</code> properly?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Sorry, I forgot to mention my edit. Basically above javascript code is inside a Partial View 2. The code where I am json encoding the model is in another Partial View 1. From P V 2, I cannot access the model object of P V 1, so I am just dumping the contents into a <code>div</code> tag, so that I can access this list <code>TestList</code> element.</p>