SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
The following is the json data I got from my server. However, I got the error msg as titled. But if I retype the first 8 letters ( {"data": ) , the data could be passed the testing of the http://json.parser.online.fr/ . Anyone has any idea why?
{"data":[{"guid":"0001-c0a801da-526a34b8-2b49-5a8e79e8","cs":{"corpid":"V","username":"Frank","newpassword":"","cname":"\u4f59\u826f\u5bec","ename":"Frank","phone":null,"email":"frank.yu@veden.dental","isadmin":"Y","isgroupa":"Y","groupaguid":"0001-7f000001-54c7999a-9d94-71ee1c39","isgroupc":"Y","groupcguid":"0001-7f000001-54c7999a-9d94-71ee1c39","enddate":null,"lastlogin":"2015-09-01 15:24:59","memo":null,"corpcname":"\u7dad\u767b","groupacname":"\u7cfb\u7d71\u7ba1\u7406\u54e1","groupccname":"\u7cfb\u7d71\u7ba1\u7406\u54e1"}}],"options":""}
This question has accepted answers - jump to:
Answers
Can you please link to a debug trace or the page showing the issue.
Allan
It's very weired that if you copy the data from {...} to the sublime and put the cursor at the beginning and press Delete key, you will find that there is "space" before the {. That means you have to press the Delete key twice to delete the {.
Sounds like you might have a BOM prior to the JSON data. Might be worth searching for and removing that.
Allan
Thanks Allan for the advice. Finally I use the following codes to check and remove the BOM from all of the php files and got my system working.
Good to hear. Thanks for posting your solution.
Allan