I'm having problems parsing my JSON data to a Swift array (for use in a UITableView). Can anyone guide me?
My JSON data shows as:
[{"refID":"1","publisher":"Pub1"},{"refID":"2","publisher":"Pub2"},{"refID":"3","publisher":"Pub3"}]
Any my Swift is:
override func viewDidLoad() {
super.viewDidLoad()
let url = NSURL(string: "http://myurl/index.php")
var request = NSURLRequest(URL: url!)
var data = NSURLConnection.sendSynchronousRequest(request, returningResponse: nil, error: nil)
if data != nil {
pubJSON = JSON(data: data!)
println(pubJSON)
}
I can see the JSON in the output window so Xcode is reading it, but Im stumped as to the next step of converting it to an array.
Many thanks for any advice.