title: The JSON value could not be converted to System.Nullable`1[System.DateTime]
body: <p>Using Powershell in Azure DevOps release pipeline, I am trying to convert parameters into json format before posting to a asp netcore endpoint. One of the parameters is datetime.</p>
  
  <p>I am getting the following error for the DateTime type:</p>
  
  <pre><code>"errors":{"$.CreatedDate":["The JSON value could not be converted to System.Nullable`1[System.DateTime].
  </code></pre>
  
  <p>Here is the Powershell script. The variable <code>$(RELEASE.DEPLOYMENT.STARTTIME)</code> is a DevOps variable and outputs the date format <code>2020-06-15 10:00:46Z</code></p>
  
  <pre><code>$params = @{   
     Name = "Test"
      CreatedDate = $(RELEASE.DEPLOYMENT.STARTTIME) 
  }
  
  Invoke-WebRequest -Uri https://mynetcoreendpoint -Method POST -Body ($params | ConvertTo-Json) -ContentType "application/json" -UseBasicParsing
  </code></pre>
  
  <p>The json is evaluated at the endpoint side. Here is the NetCore endpoint</p>
  
  <pre><code>[HttpPost]
  public ActionResult&lt;ReleaseDTO&gt; CreateRelease(ReleaseDTO release)
   {
      // Do some stuff
   }
  
   // Where ReleaseDTO has the property 
  
   public DateTime? CreatedDate { get; set; }
  </code></pre>