title: Error sending json in POST to web API service
body: <p>I'm creating a web service using Web API. I implemented a simple class</p>
  
  <pre><code>public class ActivityResult
  {
      public String code;
      public int indexValue;
      public int primaryCodeReference;
  }
  </code></pre>
  
  <p>And then I have implemented inside my controller</p>
  
  <pre><code>[HttpPost]
  public HttpResponseMessage Post(ActivityResult ar)
  {
      return new HttpResponseMessage(HttpStatusCode.OK);
  }
  </code></pre>
  
  <p>But when I call the API passing in POST the file json:</p>
  
  <pre><code>{"code":"XXX-542","indexValue":"3","primaryCodeReference":"7"}
  </code></pre>
  
  <p>I obtain the following error message:</p>
  
  <pre><code>{
      "Message": "The request entity's media type 'text/plain' is not supported for this resource.",
      "ExceptionMessage": "No MediaTypeFormatter is available to read an object of type 'ActivityResult' from content with media type 'text/plain'.",
      "ExceptionType": "System.Net.Http.UnsupportedMediaTypeException",
      "StackTrace": "   in System.Net.Http.HttpContentExtensions.ReadAsAsync[T](HttpContent content, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)\r\n   in System.Net.Http.HttpContentExtensions.ReadAsAsync(HttpContent content, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)\r\n   in System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)"
  }
  </code></pre>
  
  <p>What am I doing wrong?</p>