报错处理 Uncaught SyntaxError: Unexpected end of JSON input

报错:Uncaught SyntaxError: Unexpected end of JSON input

 

若对象的参数或数组的元素中遇到地址,地址中包括 /、\、?、& 这些特殊符号时

对象/数组先要通过JSON.stringify转化为JSON格式再通过encodeURIComponent编码,

接收时,先通过decodeURIComponent解码再通过JSON.parse转换为JSON格式的对象/数组

注意操作顺序

参考文章: https://blog.csdn.net/qq_45812488/article/details/121733338

posted @ 2022-06-23 08:46  往糖悦  阅读(1348)  评论(0)    收藏  举报