JSONSerialization Invalid type in JSON write (_SwiftValue)
<p>Why does the following code give me the error:</p>

<blockquote>
  <p>Invalid type in JSON write (_SwiftValue).</p>
</blockquote>

<p>The error is thrown on this line:</p>

<pre><code>urlRequest.httpBody = try JSONSerialization.data(withJSONObject: parameters)
</code></pre>

<p>Full code:</p>

<pre><code>let parameters:Parameters = ["resource":[
        [
            "appUserCode":uuidString,
            "productNFCode": self.nfCode!,
            "status":code,
            "applicationKey":appDelegate.api_key
        ]
        ]
    ]
    do {

        urlRequest.httpBody = try JSONSerialization.data(withJSONObject: parameters)
    } catch {
        // No-op
    }
</code></pre>