“意外的令牌{”当使用jquery.parsejson()
"Unexpected token {" when using jquery.parsejson()
当我控制台记录我的返回数据时,它看起来像这样:
returnData =
"{"requests":[{"region": "NA","message": "test","monster": "For Fun",
"roomNumber" : "", "password" : "", "HR" : ""}
{"region": "NA","message": "test","monster": "For Fun", "roomNumber" : "",
"password" : "", "HR" : ""}
]}"
当我尝试jQuery.parseJSON(returnData)
时,它会返回意外令牌{
我不确定需要发生什么。任何想法都会很棒!谢谢
{"region": "NA","message": "test","monster": "For Fun",
"roomNumber" : "", "password" : "", "HR" : ""}
}
后应该有一个逗号,以便一个对象被另一个对象分隔:
{"region": "NA","message": "test","monster": "For Fun", "roomNumber" : "",
"password" : "", "HR" : ""}
实际上,它不是一个有效的json
。
您可以使用此验证器进行检查。将此验证器用于以下 JSON
{
"requests": [
{
"region": "NA",
"message": "test",
"monster": "For Fun",
"roomNumber": "",
"password": "",
"HR": ""
},
{
"region": "NA",
"message": "test",
"monster": "For Fun",
"roomNumber": "",
"password": "",
"HR": ""
}
]
}
我明白这是有效的。
缺少",":
{"requests": [{
"region": "NA",
"message ": "test",
"monster": "For Fun",
"roomNumber": "",
"password": "",
"HR": ""
}, {
"region": "NA",
"message": "test",
"monster": "For Fun",
"roomNumber": "",
"password": "",
"HR": ""
}]}
您的 JSON 无效。试试这个。
杰伦
{
"requests": [{
"region": "NA",
"message": "test",
"monster": "For Fun",
"roomNumber": "",
"password": "",
"HR": ""
},
{
"region": "NA",
"message": "test",
"monster": "For Fun",
"roomNumber": "",
"password": "",
"HR": ""
}]
}
相关文章:
- 为什么我不能使用jQuery.parseJSON(json)解析json字符串
- 如何使用jQuery.parseJSON绕过换行符
- jQuery.parseJSON()未在Windows服务器上解码有效的Json字符串
- 这行代码出了什么问题?(jQuery.parseJSON)
- jQuery.parseJSON 不适用于 Ajax Success
- “意外的令牌{”当使用jquery.parsejson()
- jQuery.parseJSON u0092 字符未解析
- jQuery.parseJSON 无法解析序列化的 C# 字典
- jQuery.parseJSON 不附加任何值
- Jquery.parseJSON 在 Firefox 3.6 上的兼容性
- jQuery.ParseJSON 变量问题
- jQuery.parseJSON 中的语法错误
- jQuery.parseJSON 不适用于给定的字符串
- 如何使用jQuery.parseJSON获取数据
- 使用jQuery.parseJSON检索包含空白的php数组
- jQuery.parseJSON给出错误意外标记
- 为什么'jQuery.parseJSON'没有必要
- JSON Parse JSON和Jquery ParseJson在visualforce中不起作用
- jQuery.ParseJSON返回一个字符串
- 有效的JSON不能与jQuery.parseJSON()一起工作