I've a dictionary with optional values:
let user = [
"name": "gui",
"username": nil,
] as [String: Any?]
that I simply want to cast to a json that should be {"name": "gui", username: null}
However, JSONSerialization.isValidJSONObject(user) returns false, and try JSONSerialization.data(withJSONObject: user) fails..
How should I handle that?