jQuery.parseJSON( json )



jQuery.parseJSON( json )


Passing in a malformed JSON string may result in an exception being thrown. For example, the following are all malformed JSON strings:
{test: 1} (test does not have double quotes around it).
{'test': 1} ('test' is using single quotes instead of double quotes).


Additionally if you pass in nothing, an empty string, null, or undefined, 'null' will be returned from parseJSON. Where the browser provides a native implementation of JSON.parse, jQuery uses it to parse the string. For details on the JSON format, see http://json.org/.




翻译:
jQuery.parseJSON( json )
传入格式有误的 JSON 字符串可能导致抛出异常。例如,下面这些 JSON 字符串格式都不对:
{test: 1} (test 没有使用双引号包裹).
{'test': 1} ('test' 用了单引号而不是双引号包裹).
另外,如果你什么都不传入,或者传入空字符串、null、undefined 等,parseJSON 都会返回 null 。如果浏览器原生实现了 JSON.parse, jQuery 则会使用它来解析字符串。更多关于JSON格式的细节请参考 http://json.org/ 







评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值