title: How to validate json request body as valid json in asp.net core
body: <p>In asp.net core 2.1, when a controller action is set as:</p>
  
  <pre><code>    [HttpPost]
      public JsonResult GetAnswer(SampleModel question)
      {               
          return Json(question.Answer);
      }
  </code></pre>
  
  <p>where the SampleModel is defined as:</p>
  
  <pre><code>public class SampleModel
  {
      [Required]
      public string Question { get; set; }
  
      public string Answer { get; set; }
  }
  </code></pre>
  
  <p>this is still considered as valid request:</p>
  
  <pre><code>{
    "question": "some question",
    "question": "some question 2",
    "answer": "some answer"
  }
  </code></pre>
  
  <p>In the controller I can see that second question is the value of model and model is valid.</p>
  
  <p>Question is how to validate just body of request as valid JSON even before model binding?</p>