title: "Invalid type in JSON write (__NSTaggedDate)" when trying to decode JSON date
body: <p>I'm getting an error "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (__NSTaggedDate)'" when I try to decode a JSON object from a databank that has a date variable. The error happens in the line: let jsonData = try JSONSerialization.data(withJSONObject: self) of the code below:</p>
  
  <pre><code>extension Array where Element == Dictionary&lt;String,Any&gt; {
      func decode&lt;T&gt;() throws -&gt; [T] where T: Codable {
          let jsonData = try JSONSerialization.data(withJSONObject: self)
          // 1.
          let decoder = JSONDecoder()
  
          // 2.
          return try decoder.decode([T].self, from: jsonData)
      }
  }
  </code></pre>
  
  <p>I'm using this method to turn the result of a Postgres SELECT query into an array of Codable objects using the PG dependency.</p>
  
  <pre><code>case .success(let result):
     let array = result.rows.map { Dictionary($0) }
  
     let objects = try! array.decode() as [Model]
  
     completion(objects,nil)
  </code></pre>