just added this three lines in my WebApiConfig.cs file...
var json = config.Formatters.JsonFormatter;
json.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects;config.Formatters.Remove(config.Formatters.XmlFormatter);
After this codes were added.the Return XML will be transferred to Json format

本文介绍如何通过修改 WebApiConfig.cs 文件中的配置将返回格式从 XML 转换为 JSON。具体操作包括设置 Newtonsoft.Json 库以保持对象引用,并移除 XML 格式的输出。
38

被折叠的 条评论
为什么被折叠?



