1
AlamofireとSwiftyJSONを使用してJSONからのデータを解析していますが、わかりました。 だから、これはこれは、私の質問は、私はJSONとのappend内の各images
配列の最初のsource
を取ることができますどのように、どのように私はAlamofireとSwiftyJSONJson Swift 3内の配列の最初の項目のみを追加する
Alamofire.request("https://graph.facebook.com/\(eventId1)/photos", method: .get, parameters: ["fields": "images", "access_token": "token"])
.responseJSON { (responseData) -> Void in
if((responseData.result.value) != nil) {
let swiftyJsonVar = JSON(responseData.result.value!)
print(swiftyJsonVar)
でそれを取得しているJSON
{
"data" : [
{
"images" : [
{
"source" : "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-9\/14680504_1200113096725648_1728625782476314570_n.jpg?oh=a20884ad66bef170b7afa9d4f109abf1&oe=585F830B",
"width" : 349,
"height" : 557
},
{
"source" : "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-0\/p320x320\/14680504_1200113096725648_1728625782476314570_n.jpg?oh=effc78bc088150bc762a79d7b0cfad6c&oe=5860B857",
"width" : 320,
"height" : 510
},
{
"source" : "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-0\/p180x540\/14680504_1200113096725648_1728625782476314570_n.jpg?oh=e014f2b98eb8152dbfd84b6fdfefc25b&oe=58913E1C",
"width" : 338,
"height" : 540
},
{
"source" : "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-0\/p130x130\/14680504_1200113096725648_1728625782476314570_n.jpg?oh=ce0430df1e0e605b2b33542634b70adb&oe=58A3A2B0",
"width" : 130,
"height" : 207
},
{
"source" : "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-0\/p75x225\/14680504_1200113096725648_1728625782476314570_n.jpg?oh=18ed8685d773104637f8a747b21783af&oe=58689107",
"width" : 140,
"height" : 225
}
],
"id" : "1200113096725648"
},
{
"images" : [
{
"source" : "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-9\/14732411_1196819920388299_7949002046479842067_n.jpg?oh=7b7a61f956594f0015dea746640f3e33&oe=589B36EA",
"width" : 294,
"height" : 171
},
{
"source" : "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-0\/p130x130\/14732411_1196819920388299_7949002046479842067_n.jpg?oh=fe74c57b606ef817aed805707fe6fe6d&oe=58A96851",
"width" : 223,
"height" : 130
}
],
"id" : "1196819920388299"
},
{
"images" : [
{
"source" : "https:\/\/scontent.xx.fbcdn.net\/t31.0-8\/14753242_1194616067275351_4639120157874462599_o.jpg",
"width" : 1920,
"height" : 1200
},
{
"source" : "https:\/\/scontent.xx.fbcdn.net\/t31.0-8\/p960x960\/14753242_1194616067275351_4639120157874462599_o.jpg",
"width" : 1536,
"height" : 960
},
{
"source" : "https:\/\/scontent.xx.fbcdn.net\/t31.0-8\/p720x720\/14753242_1194616067275351_4639120157874462599_o.jpg",
"width" : 1152,
"height" : 720
},
{
"source" : "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-9\/14650295_1194616067275351_4639120157874462599_n.jpg?oh=19248c58a8a11a4506b364aa44a7dc4a&oe=58A4E3F0",
"width" : 960,
"height" : 600
},
{
"source" : "https:\/\/scontent.xx.fbcdn.net\/t31.0-0\/p480x480\/14753242_1194616067275351_4639120157874462599_o.jpg",
"width" : 768,
"height" : 480
},
{
"source" : "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-0\/p320x320\/14650295_1194616067275351_4639120157874462599_n.jpg?oh=672575780d6ec2c46c7fc0b25421941c&oe=589800AC",
"width" : 512,
"height" : 320
},
{
"source" : "https:\/\/scontent.xx.fbcdn.net\/t31.0-0\/p180x540\/14753242_1194616067275351_4639120157874462599_o.jpg",
"width" : 864,
"height" : 540
},
{
"source" : "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-0\/p130x130\/14650295_1194616067275351_4639120157874462599_n.jpg?oh=f6441f7dde33aec00785f7f96dea31b5&oe=58A1D94B",
"width" : 208,
"height" : 130
},
{
"source" : "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-0\/p75x225\/14650295_1194616067275351_4639120157874462599_n.jpg?oh=bbe7ab23b13269a062bfcfa0afcce8e1&oe=589A7EFC",
"width" : 360,
"height" : 225
}
],
"id" : "1194616067275351"
}
],
"paging" : {
"cursors" : {
"after" : "MTE5NDYxNjA2NzI3NTM1MQZDZD",
"before" : "MTIwMDExMzA5NjcyNTY0OAZDZD"
}
}
}
ですそれは空の配列に? 私はいくつかの方法を試しましたが、最初にimages
の中に5つのソースがあります。