JSONKit failed to parse plain JSON from php?
I am using JSONKit in my iOS app. It loads an extremely simple JSON served by my php file:
http://staging.comwerks.net/terrence/ecitizen/article.php
Somehow an error occurs: "Unexpected token, desired", "",.}
When I try to use http://jsonlint.com/ to add my url above. It gives a similar error, complaining about an open parenthesis!
my php can't be simpler:
<?php
header('Content-type: application/json');
$json = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5);
echo json_encode($json);
?>
+3
source to share
2 answers
It may complain about the Unicode byte order mark at the beginning of the response. If I copy and paste the output into linter it checks. This is probably at the beginning of the article.php file. Your text editor should be able to save without it (perhaps in the "Save As ..." dialog).
+1
source to share