有没有办法控制JsonResult带属性的JSON输出,类似于你如何使用它们XmlElementAttribute以及它的bretheren来控制XML序列化的输出?
例如,给定以下类:
public class Foo
{
[SomeJsonSerializationAttribute("bar")]
public String Bar { get; set; }
[SomeJsonSerializationAttribute("oygevalt")]
public String Oygevalt { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我想得到以下输出:
{ bar: '', oygevalt: '' }
Run Code Online (Sandbox Code Playgroud)
相反:
{ Bar: '', Oygevalt: '' }
Run Code Online (Sandbox Code Playgroud)