1

I am using the jQuery getJSON method, but the returned data from a Python Django view causes the error JSON.parse: unexpected character

Below is the JSON structure:

OK[
   {
      "status":"FINISHED",
      "transcoded_file_link":"/download_xml_file/5",
      "name":"uploads/vid2.avi",
      "original_file_link":"/download_file/uploads/vid2.avi"
   },
   {
      "status":"FINISHED",
      "transcoded_file_link":"/download_xml_file/6",
      "name":"uploads/vid2_1.avi",
      "original_file_link":"/download_file/uploads/vid2_1.avi"
   },
   {
      "status":"FINISHED",
      "transcoded_file_link":"/download_xml_file/7",
      "name":"uploads/vid2_2.avi",
      "original_file_link":"/download_file/uploads/vid2_2.avi"
   }
]
1
  • 8
    That 'OK' at the beginning of your string is causing an error. Commented Jul 17, 2014 at 14:42

1 Answer 1

1

As per the comments provided the problem is with that 'OK' at the beginning.

Use like below part only with out 'OK'

[{"status": "FINISHED", "transcoded_file_link": "/download_xml_file/5", "name": "uploads/vid2.avi", "original_file_link": "/download_file/uploads/vid2.avi"}, {"status": "FINISHED", "transcoded_file_link": "/download_xml_file/6", "name": "uploads/vid2_1.avi", "original_file_link": "/download_file/uploads/vid2_1.avi"}, {"status": "FINISHED", "transcoded_file_link": "/download_xml_file/7", "name": "uploads/vid2_2.avi", "original_file_link": "/download_file/uploads/vid2_2.avi"}]
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.