0

I am developing an ASP.NET MVC project. In my project, I am returning json data to client. So I want to rename the properties of the json. So I tried to create JsonNetResult from this link https://yobriefca.se/blog/2010/11/20/better-json-serialisation-for-asp-dot-net-mvc/. But when I create that class, Visual Studio 2013 is giving me errors dealing with Newtonsoft.Json. Error seems to be a conflict.

See my screenshot:

enter image description here

enter image description here

I have never seen this error before. I also run update-package command recently. That errors show for only Newtonsoft.Json reference. How can I fix that error?

I am doing it to change json properties

public class Item{
   [JsonProperty("name")]
   public string Name{ get; set; }
   [JsonProperty("image_url")]
   public string ImageUrl{ get; set; }
}
halfer
  • 19,824
  • 17
  • 99
  • 186
Wai Yan Hein
  • 13,651
  • 35
  • 180
  • 372

1 Answers1

0
    //To produce JSON format
    var json = config.Formatters.JsonFormatter;
    config.Formatters.Clear();
    config.Formatters.Add(json);
Hitesh Thakor
  • 471
  • 2
  • 12