Reputation: 317
I am using Wunderground to gather history data, using SwiftyJSON. However, in the API, a section called "dailysummary" is curtained off in an array. Abbreviated, it looks something like this:
"history": {
"dailysummary": [{
"stuff": "here"
]}
I had tried to isolate the content inside the array with this:
var jsonData = json["history"]["dailysummary"]
var arrayData = json["history"]["dailysummary"][0]
jsonData = json["history"]["dailysummary"][arrayData]
This code returns an error saying it cannot subscript a value of type 'JSON' with an index of type 'JSON'
. Is there any way to make this work, or a way to get the data from to array in this format?
Upvotes: 1
Views: 2720
Reputation: 112857
You want something like:
var arrayData = json["history"]["dailysummary"][0]["stuff"].
arrayData
is a dictionary.
Upvotes: 1