通过js跳转页面传递json参数的方式:
const data = {
name: "John",
age: 30
};
把jsonx成字符串进行编码
const encodedData = encodeURIComponent(JSON.stringify(data));
window.location.href = "https:baidu.com?data=" + encodedData;
另外一个页面接收:
把编码的字符串进行解密再json序列化成对象
encodedData ='%7B%22name%22%3A%22John%22%2C%22age%22%3A30%7D'
const decodedData = decodeURIComponent(encodedData);
decodedData ='{"name":"John","age":30}'
const data = JSON.parse(decodedData);