import UIKit
import AVFoundation
let dictionary = ["aKey": "aValue","anotherKey": "anotherValue"]
let theJSONData = NSJSONSerialization.dataWithJSONObject(
dictionary,
options: NSJSONWritingOptions(0),
error: nil)
let theJSONText = NSString(data: theJSONData!,
encoding: NSASCIIStringEncoding)
println("JSON string = \(theJSONText!)")
放在playground 可以看看OK?哈哈
原文链接:https://www.f2er.com/swift/327173.html