title: swift Dictionary with [UInt8] as value convert to json string
body: <p>I create a swift class as shown below:</p>
  
  <pre><code> class Message {
      var type:String
      var content:[UInt8] = [UInt8]()
      init(type:String, content:[UInt8]) {
          self.type = type
          self.content = content
      }
  func jsonAsString()-&gt;String {
      var dict = [String: AnyObject]()
      let mirror = Mirror(reflecting: self)
      for (_, attr) in mirror.children.enumerate() {
          if let property_name = attr.label as String! {
              print("property_name: \(property_name) and value:\(attr.value)")
              dict[property_name] = attr.value as? AnyObject
          }
      }
      do {
          let jsonData = try NSJSONSerialization.dataWithJSONObject(dict, options: NSJSONWritingOptions.PrettyPrinted)
          return (String(data: jsonData, encoding: NSUTF8StringEncoding)?.stringByReplacingOccurrencesOfString(" ", withString: ""))!
      } catch {
          NSLog("ERROR when parse JSON")
      }
      return ""
  }
  }
  </code></pre>
  
  <p>I want to call the function 'jsonAsString' to get a json string, but the property 'content' which is an uint8 array not convert correctly.
  As I found a lot, some one suggest to replace </p>
  
  <blockquote>
    <p>var dict = String: AnyObject with 
    var dict = String: Any</p>
  </blockquote>
  
  <p>But this type of dictionary is not supported by the method</p>
  
  <blockquote>
    <p>NSJSONSerialization.dataWithJSONObject(obj: AnyObject, options opt: NSJSONWritingOptions) throws -> NSData</p>
  </blockquote>