我的一個函數的返回下面的字符串:jquery.parseJSON不工作
{
"data": [{
"type": "facebook",
"id": "639422616",
"name": "Neal Cabage",
"message": "Ruby on rails or Sinatra better for a restful app that speaks json, not html?"
}, {
"type": "facebook",
"id": "100001604824773",
"name": "Christolle Soragee",
"message": "When you lose: "
Who cares ? !It 's just a game!" When you win: "HAHAHA IN YOUR FACE LOSER!""},{"type":"facebook","id":"100000049925091","name":"Chris Cassanova Dunphy","message":"It'
s sad when you already know you 're gonna get ripped off and you have to junkie proof your stash... Hahaha good thing I was on point! It'
s funny how people with a problem will ruin a good thing just "}]}
當我使用jQuery.parseJSON(response)
,它拋出異常在某些情況下,當消息有內部消息雙引號。
任何幫助或建議將不勝感激。
由於
如果您在字符串中引用錯誤,那麼您生成的JSON效果很差。你需要引用你可能傳給'json_encode()'的字符串。在發佈之前,您是否試圖解決此問題_at all_? – Bojangles
問題是,你必須轉義你的一些「 –
」爲了測試你的JSON的有效性使用[JSONLint](http://jsonlint.com/)。它顯示在第13行有一個錯誤。 –