我从一个站点提取一个JSON文件,其中一个字符串是:
The Weeknd ‘King Of The Fall’ [Video Premiere] | @TheWeeknd | #SoPhi
Run Code Online (Sandbox Code Playgroud)
如何将事物‘转换为正确的字符?
我已经制作了一个Xcode Playground来演示它:
import UIKit
var error: NSError?
let blogUrl: NSURL = NSURL.URLWithString("http://sophisticatedignorance.net/api/get_recent_summary/")
let jsonData = NSData(contentsOfURL: blogUrl)
let dataDictionary = NSJSONSerialization.JSONObjectWithData(jsonData, options: nil, error: &error) as NSDictionary
var a = dataDictionary["posts"] as NSArray
println(a[0]["title"])
Run Code Online (Sandbox Code Playgroud)