title: Prevent $id/$ref when serializing objects using Web API and JSON.NET
body: <p>I can't seem to prevent Web API/JSON.NET from using <code>Newtonsoft.Json.PreserveReferencesHandling.Objects</code> when serializing objects.  In other words, $id/$ref are always used in the serialized objects despite using the following settings:</p>
  
  <pre><code>public class MvcApplication : System.Web.HttpApplication {
  
      protected void Application_Start () {
          WebApiConfig.Register(GlobalConfiguration.Configuration);
      }
  
  }
  
  public static class WebApiConfig {
  
      public static void Register (HttpConfiguration config) {
          JsonMediaTypeFormatter jsonFormatter = config.Formatters.OfType&lt;JsonMediaTypeFormatter&gt;().Single();
          jsonFormatter.UseDataContractJsonSerializer = false;
          jsonFormatter.SerializerSettings.Formatting = Newtonsoft.Json.Formatting.Indented;
          jsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
          jsonFormatter.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.None;
      }
  
  }
  </code></pre>
  
  <p>Any ideas?</p>