mvc 4 assembly reference missing for Json.Encode

asp.net-mvc-4, assembly-references, json

Solution

- References in solutions explorer > right click > Add reference

- Under Assemblies > Framework, search for "System.Web.Helpers" Double click

- System.Web.Helpers version 2.0.0.0 and click ok. Find the

- System.Web.Helpers you've just added > right click it > properties.

- Change "Copy Local" from false, to true

And now @Json.Encode should work.

Update

Problem

I am trying to call a `Json.Encode(...)` method in MVC 4 and I'm getting an error: `The name 'Json' does not exist in the current context.` I've tried adding `System.Runtime.Serialization` namespace, which has `Json` class, but this particular instance of `Json` class doesn't have `Encode` method. What assembly am I missing here? Here is my exact code: ``` { url: '@Url.Action("DeleteDefinitionRule")', editData: { companyCode: 'LO', definitionID:@Html.Raw(Json.Encode(Model.DefinitionID)) } } ```

Original source

Related problems