Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Swift

Andrés Leal
Andrés Leal
9,563 Points

How to parse JSON with swiftyJSON

I am trying again and again to parse the thumbnail path address from this JSON

"data":{ "offset":0, "limit":20, "total":1491, "count":20, "results":[
{
"id":1011334, "name":"3-D Man", "description":"", "modified":"2014-04-29T14:18:17-0400", "thumbnail":{
"path":"http://i.annihil.us/u/prod/marvel/i/mg/c/e0/535fecbbb9784", "extension":"jpg" },

But I can't seem to have found the answer to my question. I am doing this:

for (key, subJson) in json["data", "results", "thumbnail", "path", 0] { if let imagePath = subJson["path"].string { print(imagePath) let finalImagePath = imagePath + "somestring with my priv key and pub key" print(finalImagePath) } }

I would much appreciate if someone give me the answer to this, I have been struggling for so long now.

Thanks in advance