how to remove $id during JSON serialization

I added this code to my WebApiConfig register method and I got rid of all $id in JSON.

var json = config.Formatters.JsonFormatter;
json.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.None;

Leave a Comment