title: 'IJsonHelper' does not contain a definition for 'Encode'
body: <p>I want to convert a list of strings to a javascript array in my view, and I've found the below suggestion in a few places on the internet:</p>
  
  <pre><code>@model IEnumerable&lt;DSSTools.Models.Box.BoxWhiteListUser&gt;
  
  @{
      var boxManager = new DSSTools.Managers.BoxManager();
      var allusers = boxManager.GetAllUsersAsync().Result.Entries.ToList().Select(u =&gt; u.Login);
  }
  
  @section Scripts {
      &lt;script&gt;
          var sourcearray = null;
  
          $(document).ready(function () {
              var arr = JSON.parse('@Html.Raw(Json.Encode(@allusers))');
          });
      &lt;/script&gt;
  }
  </code></pre>
  
  <p>However, I just get an annoying</p>
  
  <blockquote>
    <p>'IJsonHelper' does not contain a definition for 'Encode' and no extension method 'Encode' accepting a first argument of type 'IJsonHelper' could be found (are you missing a using directive or an assembly reference?)</p>
  </blockquote>
  
  <p>How is this possible?</p>
  
  <p>I also tried simply calling</p>
  
  <pre><code>var arr = JSON.parse('@Html.Raw(allusers)');
  </code></pre>
  
  <p>But then I get this error in the console</p>
  
  <pre><code>VM189:1 Uncaught SyntaxError: Unexpected token S in JSON at position 0
      at JSON.parse (&lt;anonymous&gt;)
      at HTMLDocument.&lt;anonymous&gt; (whitelist:107)
      at fire (jquery.js:3182)
      at Object.fireWith [as resolveWith] (jquery.js:3312)
      at Function.ready (jquery.js:3531)
      at HTMLDocument.completed (jquery.js:3547)
  </code></pre>