开发者

json parsererror

开发者 https://www.devze.com 2023-01-23 20:32 出处:网络
why this error xhr: [object XMLHttpRequest] textStatus: parsererror errorThrown: Invalid JSON: [ { \"id\": \"10000000\", \"label\": \"10000000\" }, { \"id\": \"10000001\", \"label\": \"10000001\" }

why this error

xhr: [object XMLHttpRequest] textStatus: parsererror errorThrown: Invalid JSON: [ { "id": "10000000", "label": "10000000" }, { "id": "10000001", "label": "10000001" }, {开发者_如何学编程 "id": "10000003", "label": "10000003" }, { "id": "10000005", "label": "10000005" }, { "id": "10000006", "label": "10000006" } ]


Copied and pasted this:

[ { "id": "10000000", "label": "10000000" }, { "id": "10000001", "label": "10000001" }, { "id": "10000003", "label": "10000003" }, { "id": "10000005", "label": "10000005" }, { "id": "10000006", "label": "10000006" }]

to JSONlint and it says it's valid.


Can you post the original JSON if that is the original then the it is missing a root key

var textStatus = {"keys":[{"id":"...", "label":"..."},{"id":"...","label":"..."}]}

Also the whole thing needs to be inside {} to make it an object what you had is just an array

0

精彩评论

暂无评论...
验证码 换一张
取 消