title: Crash : Convert dictionary to Json string in Swift 3
body: <p>I'm trying to convert my swift dictionary to Json string but getting strange crash by saying</p>
  
  <p>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (_SwiftValue)'</p>
  
  <p>My code:</p>
  
  <pre><code>let jsonObject: [String: AnyObject] = [
              "firstname": "aaa",
              "lastname": "sss",
              "email": "my_email",
              "nickname": "ddd",
              "password": "123",
              "username": "qqq"
              ]
  
  do {
      let jsonData = try JSONSerialization.data(withJSONObject: jsonObject, options: .prettyPrinted)
      // here "jsonData" is the dictionary encoded in JSON data
  
      let decoded = try JSONSerialization.jsonObject(with: jsonData, options: [])
      // here "decoded" is of type `Any`, decoded from JSON data
  
      // you can now cast it with the right type
      if let dictFromJSON = decoded as? [String:String] {
          // use dictFromJSON
      }
  } catch {
      print(error.localizedDescription)
  }
  </code></pre>
  
  <p>Please help me!</p>
  
  <p>Regards.</p>