I have a PHP page which echos some JSON
like so:
echo json_encode("Hello");
How can I access this in my swift app? I used a method to get data from the website before, when I println
the data returned, it just prints all of the HTML code for the website (including tags).
let url = NSURL(string: myLinkUrl)
let request = NSURLRequest(URL: url!)
NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()) {(response, data, error) in
println(NSString(data: data, encoding: NSASCIIStringEncoding)) //Prints HTML code
}
I would like to know how to only print the data that the page echos (in this case 'Hello')