2015-08-28 86 views
1

我無法弄清楚爲什麼在使用jsonlint.com進行測試後,這是無效的JSON。這只是一個對象數組,我沒有看到任何遺漏或不合適的地方。JSON陣列形式的問題

[ 
    { 
     「rel」: 「self」, 
     "href": "http://ourdomain/persons", 
     "name": { 
      "last": "best" 
     } 
    }, 
    { 
     「rel」: 「self」, 
     "href": "http://ourdomain/persons", 
     "name": { 
      "last": "bet" 
     } 
    }, 
    { 
     「rel」: 「self」, 
     "href": "http://ourdomain/persons", 
     "name": { 
      "last": "brown" 
     } 
    } 
] 

回答

2

看看引號包裝relself

[ 
{ 
    "rel": "self", 
    "href": "http://ourdomain/persons", 
    "name": { 
     "last": "best" 
    } 
}, 
{ 
    "rel": "self", 
    "href": "http://ourdomain/persons", 
    "name": { 
     "last": "bet" 
    } 
}, 
{ 
    "rel": "self", 
    "href": "http://ourdomain/persons", 
    "name": { 
     "last": "brown" 
    } 
} 

]

DONE!

1

你得到的問題是引號被另一個HTML字符替換。

如果你看這裏「rel」: 「self」,你會發現它使用而不是"。替換它們,你應該沒問題。