(已解决)Unexpected token o in JSON at position 1;at api request success callback function SyntaxError:

在做微信小程序解析Json数据时报错:Unexpected token o in JSON at position 1;at api request success callback function
SyntaxError: Unexpected token o in JSON at position 1
在这里插入图片描述
在这里插入图片描述
stringify(object): 将 object 对象转换为 JSON 字符串,并返回该字符串。
parse(string): 将 JSON 字符串转化成对象,并返回该对象。

报错原因是返回的数据已经是object格式,无需再使用JSON.parse(result.data)进行格式转换,直接使用result.data即可
在这里插入图片描述

posted @ 2020-02-27 16:23  榆阳123  阅读(86)  评论(0)    收藏  举报