title: How to return JSON response object
body: <p>I am getting this error even though I added media formatter as follows. I am testing with <strong>postman</strong>. Postman headers content-type is application/json and body is x-www-form-urlencoded. How can I fix it?</p>
  
  <blockquote>
    <p>"ExceptionMessage": "No MediaTypeFormatter is available to read an
    object of type 'Initiate' from content with media type 'text/html'.",
    "ExceptionType": "System.Net.Http.UnsupportedMediaTypeException"</p>
  </blockquote>
  
  <p>Here is my code sample:</p>
  
  <pre><code>[RoutePrefix("api/v1/pin")]
  public class GameController : ApiController
  {
  
      // POST: api/Game
      [HttpPost, Route("initiation")]
      public async System.Threading.Tasks.Task&lt;Initiate&gt; PurchaseInitiationAsync([FromBody]Initiate value)
      {
  
          if (value == null)
          {
              var message = new HttpResponseMessage(HttpStatusCode.NotFound)
              {
                  Content = new StringContent(string.Format("Request is NULL! Please check your data.")),  
                  ReasonPhrase = "Request is NULL! Please check your data."
              };
  
              throw new HttpResponseException(message);
          }
  
          HttpClient httpClient = new HttpClient();
  
          HttpContent content = new StringContent(
              JsonConvert.SerializeObject(value),
              Encoding.UTF8,
              "application/json"
          );
  
  
  
          HttpResponseMessage response =
              await httpClient.PostAsync("http://test:1907/purchase_initiation", content);
  
  
          var obj = response.Content.ReadAsAsync&lt;Initiate&gt;(
              new List&lt;MediaTypeFormatter&gt;
              {
                  new JsonMediaTypeFormatter()
              }).Result;
  
          return obj;
      }
  
  
  }
  </code></pre>