小程序报错Unexpected end of JSON input如下图
原因
参数中有不识别的字符
解决方案
使用encodeURIComponent编码
//父页面
let item = JSON.stringify(json)
wx.navigateTo({
url: '/xxx?item=' + encodeURIComponent(item)
})
//子页面
onLoad: function(options){
let item = JSON.parse(decodeURIComponent(optines.item))
}