Newtonsoft JSON for .net is ignoring jsonproperty tags

Are you sure you’re actually serializing using Json.Net? Json(MyClass) is an ASP.NET MVC method. MVC uses the JavaScriptSerializer class, which does not support [JsonProperty] attributes. To use the attributes, you would need to serialize using the Json.Net method JsonConvert.SerializeObject(MyClass). If you want to return that JSON from within an MVC controller then you would need call Content(jsonString, "application/json") instead of Json().

Leave a Comment