[英]How to parse this JSON data in swift
從網絡服務器解析json數據時遇到問題。 如果有人可以幫助我,我將非常感激。 我在iOS應用程序中使用swift。 任何參考文獻也將有很大幫助。
[
{
"0": "M26177M21MUG",
"1": "Imbwa yigisha umwana gukambakamba",
"2": "147746956612e34",
"3": "2016/10/26",
"4": "Amazing Video",
"5": "2016-10-26",
"videokey": "M26177M21MUG",
"title": "Imbwa yigisha umwana gukambakamba",
"file_name": "147746956612e34",
"file_directory": "2016/10/26",
"description": "Amazing Video",
"datecreated": "2016-10-26"
},
{
"0": "HDYBX1NOBBU7",
"1": "KIGALI NZIZA 2016 2040",
"2": "1477409119f676f",
"3": "2016/10/25",
"4": "KIGALI NZIZA 2016 2040",
"5": "2016-10-25",
"videokey": "HDYBX1NOBBU7",
"title": "KIGALI NZIZA 2016 2040",
"file_name": "1477409119f676f",
"file_directory": "2016/10/25",
"description": "KIGALI NZIZA 2016 2040",
"datecreated": "2016-10-25"
},
{
"0": "6ANO5UXHAD76",
"1": "Umugabo yigishije imbwa ye gusenga mbere yo kurya",
"2": "147746949813fd9",
"3": "2016/10/26",
"4": "NGWINO by KNC New Rwandan music 2013",
"5": "2016-10-26",
"videokey": "6ANO5UXHAD76",
"title": "Umugabo yigishije imbwa ye gusenga mbere yo kurya",
"file_name": "147746949813fd9",
"file_directory": "2016/10/26",
"description": "NGWINO by KNC New Rwandan music 2013",
"datecreated": "2016-10-26"
}]
我獲取數據的鏈接是:
http://marieadelaideschool.rw/stream/api/vod.php
我認為使用Alamofire的此示例功能將對您有所幫助...
func callApi()
{
Alamofire.request(.GET, "http://marieadelaideschool.rw/stream/api/vod.php", encoding: .JSON).responseJSON
{
response in switch response.2
{
case .Success(let JSON):
print(JSON)
let responseData = JSON as! NSArray
for i in responseData
{
let object = i as! NSDictionary
let title = object["title"]
print(title!)
}
break
case .Failure(let error):
print("Request failed with error: \(error)")
break
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.