我正在使用jQuery getJSON
方法,但是从Python Django视图返回的数据会导致错误JSON.parse: unexpected character
以下是JSON结构:
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"
}
]
答案 0 :(得分:1)
根据提供的评论,问题在开头就是' 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"}]