Java二维数组的序列化和反序列化

依赖:fastjson 

public static void main(String[] args) {String wires = "[[\"abc\"],[\"def\"]]";//反序列化String[][] strings = JSON.parseObject(wires, String[][].class);//数组转成ListList> collect = Arrays.stream(strings).map(x -> Arrays.stream(x).collect(Collectors.toList())).collect(Collectors.toList());//数据操作....//两种序列化结果一样System.out.println(JSON.toJSONString(collect));System.out.println(JSON.toJSONString(strings));}


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部