0
{"cover":"http:\/\/files.domain.com\/some_file\/1234.jpg_thumb.png"}

This is my JSON code and when I tries to parse, it returns Unexpected Token error. I checked on http://jsonlint.com/ but it didn't go well.

I used php json_encode function to encode JSON.

++ update It works fine when I copy JSON string and paste it in Notepad or other plain text editors and re-copy that. I think it must be some encoding error or something. I'll try.

2
  • What are you using to decode it? Commented May 11, 2014 at 5:39
  • Also, could you include the code that encodes the data, and also the code that decodes it? Commented May 11, 2014 at 5:43

1 Answer 1

1

I Fixed it. It was very simple to find out; I captured packet and view hex, and there's other byte in json. My php file encoding was UTF-8 with BOM! I simply converted it to utf-8 without bom, and all is well.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.