拿到的json字符串:
result = {"user":{"name":"laoqiren","email":"7806494@qq.com","i mage":"https://sfault-avatar.b0.upaiyun.com/888/223/8882 23038-5646dbc28d530_huge256"},"totalTime":1.5,"date":"20 16-09-23","comment":"发发"}
使用JSON.parse(result)
报错:
Unexpected end of input
请问这是怎么回事呢,谢谢
json是可以做对象调用的字符串啊……你拿到的返回本身就可以直接当对象用啊…… JSON.parse接受的参数一定是纯的字符串,或者是你用JSON.stringify()把JSON对象转成的、或者你自己纯手动拼出来的,你拿个JSON对象输进去肯定是不对的噻~~~