核心点说明:
一、首先将js对象转为json,然后将json通过base64加密(防止后台接收乱码,特殊符号等各种奇葩问题)
json = JSON.stringify(list);
console.log(BASE64.encoder(json));
js的base64加密传送门
二、java后台处理
import org.apache.commons.codec.binary.Base64;//依赖包String json = json.replace(" ", "+");//base64解密部分乱码问题(“+” 号,在urlecode编码中会被解码成空格)
json = new String(Base64.decodeBase64(json), "UTF-8");
List<Map> products = new ObjectMapper().readValue(json, List.class);
目前这种情况使用还是比较频繁,而且实用…………记录以备后续提升效率