'IJsonHelper' does not contain a definition for 'Encode'
Your answer can be simplified from:
sourcearray = JSON.parse('@Html.Raw(Json.Serialize(allusers))');
To:
sourcearray = @Json.Serialize(allusers);
Explanation:
Json.Serialize()
returnsIHtmlContent
, which does not need to be wrapped inside@Html.Raw()
to preserve special characters.- The text returned by
@Json.Serialize()
is already valid javascript object syntax. You're better off using it as is, rather than converting it to a string by wrapping it in quotes and then converting that string to an object viaJSON.Parse()
.
I managed to do what I needed with
sourcearray = JSON.parse('@Html.Raw(Json.Serialize(allusers))');