Reputation: 141
I'm using SwiftyJson and I wrote the code below,
for (_, value) in json["assets"] {
print(value)
}
I got this result in my console what is I expect:
[
{
"urlImage" : "https:myFirstUrl",
"page" : 1
},
{
"urlImage" : "https:mySecondUrl",
"page" : 2
}]
But now I want to retrieve "urlImage" to assign this value in a constant.
Upvotes: 0
Views: 61
Reputation: 1166
You can try this:
for (_, value) in json["assets"] {
for item in value.arrayValue {
let url = item["urlImage"].stringValue
print(url)
}
}
I hope it helps.
Upvotes: 2