title: &quot; is JSON string
body: <p>I have a JSON string which looks like this when displayed in an ASP.NET MVC page using @Model.JsonData</p>
  
  <pre><code>[
    {
      "id": 123,
      "text": "Consumer",
      "parent": "#";
    }
  ]
  </code></pre>
  
  <p>When I use the same @Model.JsonData in the JavaScript code it is encoded as:</p>
  
  <pre><code>[
    {
      &amp;quot;id&amp;quot;: 123,
      &amp;quot;text&amp;quot;: &amp;quot;Consumer&amp;quot;,
      &amp;quot;parent&amp;quot;: &amp;quot;#&amp;quot;
    }
  ]
  </code></pre>
  
  <p>Why does the JavaScript segment encode the double quotes?</p>
  
  <p>When the double quotes are encoded the jstree plugin expecting JSON data does not work.</p>
  
  <pre><code>&lt;script&gt;
      $(function () {
          $('#jstree').jstree({
              'core': {
                  'data': function ()
                  {
                      var jsonTreeData = @Model.JsonTreeData;
                      return jsonTreeData;
                  }
              }
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>Error message:
  "SCRIPT1015: Unterminated string constant"</p>