Ключ API YouTube в PhoneGap

Ниже приведен пример Swift Playground:

import UIKit

let jsonString = "{\"name\": \"John Doe\", \"phone\":123456}"

let data = jsonString.data(using: .utf8)

var jsonObject: Any
do {
    jsonObject = try JSONSerialization.jsonObject(with: data!) as Any

    if let obj = jsonObject as? NSDictionary {
        print(obj["name"])
    }
} catch {
    print("error")
}
0
задан Jack Fingleton 25 February 2015 в 07:25
поделиться