Is it possible?
I have a class like this:
public class ABC { [Key] [ScriptIgnore] public int Id { get; set; } public string Name { get; set; } public string AnotherField { get; set; } [ScriptIgnore] public virtual User User { get; set; } }
But I would like to serialize as follows { "name":"foo", "anotherField":"bar" } instead of { "name":"foo", "anotherField":"bar" } .
This is how I use:
return Request.CreateResponse(HttpStatusCode.OK, new JavaScriptSerializer().Serialize(obj));
c # asp.net-mvc asp.net-mvc-4
Fabricio
source share