PHP Parse error with valid JSON -
i validated json jsonlint , when line 25 of script runs looks like:
$temp = json_decode( $obj->hints,true ); i getting a:
parse error: syntax error, unexpected 'hintsacross' (t_string) in c:\program files (x86)\zend\apache2\htdocs\crosswords\query.blockouts.php on line 25
coming out script. wondering how make parse error go away. json:
{    "hintsacross": [           { "number": "1", "hinttext": "hurt", "hintsquare": "a1" },           { "number": "5", "hinttext": "make selection", "hintsquare": "a6" },          { "number": "8", "hinttext": "frank", "hintsquare": "a10" } ],     "hintsdown": [           { "number": "1", "hinttext": "first greek letter", "hintsquare": "a1" },          { "number": "2", "hinttext": "used footnotes", "hintsquare": "a2" },           { "number": "3", "hinttext": "listened to", "hintsquare": "a3" } ]  }  thanks in advance...
make sure passing valid string json_decode function.
 $myarray = json_decode("{"k":1}",1); // wont work input json string breaks and put string like
 $myarray = json_decode('{"k":1}',1); // works 
Comments
Post a Comment