Jacco Posted 2 hours ago Share Posted 2 hours ago I'm calling PHP from a webpage and I want to pass the resulting JSON back to the webpage with this $jsonString = json_encode($generationResponse); print_r($jsonString); echo $jsonString; According to print_r($jsonString); the json string is '{"code":200,"msg":"success","data":{"taskId":"91a5c1544dba3ceb0c84f9b96300938c"}}' which is OK and valid JSON. But my webpage gives an error Error generating audio: SyntaxError: Unexpected token 'A', "Array ( "... is not valid JSON Can anybody help me with this Quote Link to comment https://forums.phpfreaks.com/topic/330114-error-generating-audio-syntaxerror-unexpected-token-a-array-is-not-valid-json/ Share on other sites More sharing options...
requinix Posted 1 hour ago Share Posted 1 hour ago Now that you've confirmed the string is what you expect (I assume), you need to remove that line. Because it's getting in the way of your script outputting valid JSON. Quote Link to comment https://forums.phpfreaks.com/topic/330114-error-generating-audio-syntaxerror-unexpected-token-a-array-is-not-valid-json/#findComment-1658004 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.