What's wrong with the JSON available at the link below???
http://bruceexpress.com/beerstore/test/getottawaeaststorebeerlist.php
Using PHP, I generated the above JSON from an SQL query and encoded it with json_encode.
$retval = mysqli_query($connection, $sql);
if(! $retval )
{
print('Could not select: ' . mysqli_error());
}
$storearray = array();
while($row = mysqli_fetch_assoc($retval))
{
$storearray[] = $row;
}
header('Content-Type: application/json');
echo json_encode($storearray);
In SWIFT:
json = try NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.MutableContainers)
is throwing the NSCocoaErrorDomain Code=3840 exception. "JSON text did not start with array...."
I caught the exception and printed the data, and I am seeing this:
("<!DOCTYPE html>\n[{\"beer_id\":\"1650\",\"store_id\":\"4618\"},{\"beer_id\":\"1650\",\"store_id\":\"4607\"},{\"beer_id\":\"1650\",\"store_id\":\"4616\"},{\"beer_id\":\"1650\",\"store_id\":\"4604\"},{\"beer_id\":\"5213\",
.......... ( etc. I didn't copy the whole thing. Its too long.")
I know there are many questions like this, but I am still not seeing the answer I need. What is wrong my JSON???