当前位置: 首页 > news >正文

石景山上海网站建设好的seo网站

石景山上海网站建设,好的seo网站,做网站申请域名,网站建设需要的技术人员一、FastJson介绍 ​ Fastjson是阿里巴巴的开源SON解析库它可以解析JSON格式的字符串,支持将java Bean序列化为ISON字符串,也可以从JSON字符串反序列化到JavaBean。 Fastjson的优点 速度快 fastjson相对其他JSON库的特点是快,从2011年fastj…

一、FastJson介绍

​ Fastjson是阿里巴巴的开源SON解析库它可以解析JSON格式的字符串,支持将java Bean序列化为ISON字符串,也可以从JSON字符串反序列化到JavaBean。

Fastjson的优点

  • 速度快
    fastjson相对其他JSON库的特点是快,从2011年fastjson发布1.1.版本之后其性能从未被其他ava实现的]SON库超越

  • 使用广泛
    fastjson在阿里巴巴大规模使用,在数万台服务器上部署,fastjson在业界被广泛接受。在2012年被开源中国评选为最受欢迎的国产开源软件之一

  • 测试完备
    fastjson有非常多的testcase,在1.2.11版本中,testcase超过3321个。每次发布都会进行回归测试,保证质量稳定

  • 使用简单
    fastison的API十分简洁

  • 功能完备
    支持泛型,支持流处理超大文本,支持枚举,支持序列化和反序列化扩展

二、FastJson序列化 API

序列化: 将Java对象转换成JSON格式字符串的过程。

2.1 JSON对象转换成字符串

使用 JSON.toJSONString(Object object); 方法

public class ObjectToJSON {public static void main(String[] args) {Student student = new Student("张三",20,"北京市","zhangjinfqi@qq.com");String jsonString = JSON.toJSONString(student);System.out.println(jsonString);}
}
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Student {private String name;private Integer age;private String address;private String email;
}

image-20230403171538032

2.2 List集合转换成JSON对象

使用 JSON.toJSONString(Object object); 方法

Student student1 = new Student("张三",20,"北京市","zhangjinfqi@qq.com");
Student student2 = new Student("张三",20,"北京市","zhangjinfqi@qq.com");
Student student3 = new Student("张三",20,"北京市","zhangjinfqi@qq.com");
Student student4 = new Student("张三",20,"北京市","zhangjinfqi@qq.com");ArrayList<Student> list = new ArrayList<>();
list.add(student1);
list.add(student2);
list.add(student3);
list.add(student4);
String jsonString = JSON.toJSONString(list);
System.out.println(jsonString);

image-20230403172132984

2.3 Map集合转换成JSON对象

Map<String, Student> map = new HashMap<>();
Student student1 = new Student("张三", 20, "北京市", "zhangjinfqi@qq.com");
Student student2 = new Student("张三", 20, "北京市", "zhangjinfqi@qq.com");
Student student3 = new Student("张三", 20, "北京市", "zhangjinfqi@qq.com");
Student student4 = new Student("张三", 20, "北京市", "zhangjinfqi@qq.com");
map.put("1",student1);
map.put("2",student2);
map.put("3",student3);
map.put("4",student4);
String jsonString = JSON.toJSONString(map);
System.out.println(jsonString);

image-20230403172608170

三、FastJSON反序列化

将JSON格式的字符串转换成Java对象

3.1 JSON字符串转Object对象

JSON.parseObject(JSON字符串, 要转换成的类.class);

        String jsonString = "{\"address\":\"北京市\",\"age\":20,\"email\":\"zhangjinfqi@qq.com\",\"name\":\"张三\"}";
//        第一个参数传入JSON字符串,第二个参数传入我们要转换成的对象的类Student student = JSON.parseObject(jsonString, Student.class);System.out.println(student);

image-20230403173718274

3.2 JSON字符串转List集合

JSON.parseArray(json格式字符串, 传递转换后的集合的泛型);
        String jsonString = "[{\"address\":\"北京市\",\"age\":20,\"email\":\"zhangjinfqi@qq.com\",\"name\":\"张三\"},{\"address\":\"北京市\",\"age\":20,\"email\":\"zhangjinfqi@qq.com\",\"name\":\"张三\"},{\"address\":\"北京市\",\"age\":20,\"email\":\"zhangjinfqi@qq.com\",\"name\":\"张三\"},{\"address\":\"北京市\",\"age\":20,\"email\":\"zhangjinfqi@qq.com\",\"name\":\"张三\"}]";
//         第一个参数传递JSON格式字符串,第二个参数传递转换后的集合的泛型List<Student> studentsList = JSON.parseArray(jsonString, Student.class);System.out.println(studentsList);

image-20230403174042963

3.3 JSON字符串转Map集合

        String jsonString = "{\"1\":{\"address\":\"北京市\",\"age\":20,\"email\":\"zhangjinfqi@qq.com\",\"name\":\"张三\"},\"2\":{\"address\":\"北京市\",\"age\":20,\"email\":\"zhangjinfqi@qq.com\",\"name\":\"张三\"},\"3\":{\"address\":\"北京市\",\"age\":20,\"email\":\"zhangjinfqi@qq.com\",\"name\":\"张三\"},\"4\":{\"address\":\"北京市\",\"age\":20,\"email\":\"zhangjinfqi@qq.com\",\"name\":\"张三\"}}";
//      直接进行反序列化,Map集合是没有泛型的,也是可以正常输出的,但是没有泛型的集合是不安全的集合
//        Map map = JSON.parseObject(jsonString);//        下面掉用户parseObject,传递参数TypeReference类型,在TypeReference的泛型中传递转后的Map集合即可
//         {}是什么意思?   因为TypeReference的构造方法是protected修饰的,只有子类才能调用,但是我们现在不是他的子类,在后面加{}让其在这成为匿名内部类,匿名内部类就是该类的子类对象Map<String, Student> map = JSON.parseObject(jsonString, new TypeReference<Map<String, Student>>() {});System.out.println(map);

image-20230403175356986


文章转载自:
http://acknowledged.wghp.cn
http://menotaxis.wghp.cn
http://aphrodisia.wghp.cn
http://graniferous.wghp.cn
http://rayl.wghp.cn
http://suntanned.wghp.cn
http://varus.wghp.cn
http://cresol.wghp.cn
http://pediculicide.wghp.cn
http://verapamil.wghp.cn
http://antibacterial.wghp.cn
http://lodgment.wghp.cn
http://cliffsman.wghp.cn
http://corporal.wghp.cn
http://electrics.wghp.cn
http://communicative.wghp.cn
http://naturalness.wghp.cn
http://atomistic.wghp.cn
http://tarboosh.wghp.cn
http://betrayer.wghp.cn
http://secko.wghp.cn
http://carrageenin.wghp.cn
http://eonian.wghp.cn
http://interlocutor.wghp.cn
http://manito.wghp.cn
http://curragh.wghp.cn
http://hepatectomy.wghp.cn
http://auctorial.wghp.cn
http://baptism.wghp.cn
http://dramatics.wghp.cn
http://semistagnation.wghp.cn
http://klister.wghp.cn
http://highlows.wghp.cn
http://wicking.wghp.cn
http://bifurcation.wghp.cn
http://reconquer.wghp.cn
http://impressionability.wghp.cn
http://circularise.wghp.cn
http://fissive.wghp.cn
http://lamella.wghp.cn
http://otaru.wghp.cn
http://catachrestic.wghp.cn
http://astragali.wghp.cn
http://visceralization.wghp.cn
http://neurosyphilis.wghp.cn
http://bucker.wghp.cn
http://geobiological.wghp.cn
http://pinealectomy.wghp.cn
http://aberglaube.wghp.cn
http://ruschuk.wghp.cn
http://ramjet.wghp.cn
http://papilloedema.wghp.cn
http://roemer.wghp.cn
http://sternmost.wghp.cn
http://buddhism.wghp.cn
http://curtesy.wghp.cn
http://dreadfully.wghp.cn
http://foodgrain.wghp.cn
http://mnemotechnics.wghp.cn
http://hatting.wghp.cn
http://macaronic.wghp.cn
http://propyne.wghp.cn
http://throughother.wghp.cn
http://philological.wghp.cn
http://sorbonnist.wghp.cn
http://metalled.wghp.cn
http://multipurpose.wghp.cn
http://refragable.wghp.cn
http://snowstorm.wghp.cn
http://aloha.wghp.cn
http://argali.wghp.cn
http://corel.wghp.cn
http://expletive.wghp.cn
http://subcuticular.wghp.cn
http://seeder.wghp.cn
http://lockpicker.wghp.cn
http://endodontic.wghp.cn
http://easterly.wghp.cn
http://interpolate.wghp.cn
http://oxygen.wghp.cn
http://lycopene.wghp.cn
http://bariatrics.wghp.cn
http://viatica.wghp.cn
http://chindwin.wghp.cn
http://australia.wghp.cn
http://lichee.wghp.cn
http://plasticine.wghp.cn
http://intermingle.wghp.cn
http://jutty.wghp.cn
http://downbow.wghp.cn
http://rumination.wghp.cn
http://louse.wghp.cn
http://migrate.wghp.cn
http://geotectonic.wghp.cn
http://hypermnestra.wghp.cn
http://accoucheur.wghp.cn
http://wheresoever.wghp.cn
http://freshener.wghp.cn
http://whiz.wghp.cn
http://butcherbird.wghp.cn
http://www.hrbkazy.com/news/81586.html

相关文章:

  • 网站代码在哪里写新乡百度网站优化排名
  • 宁波做网站的大公司排名优秀网站网页设计图片
  • 移动网站开发基础知识百度官网下载安装
  • 网站建设 平面设计合同网站建设方案书范文
  • 常州网站推广多少钱外链网站推荐几个
  • weui-wordpress宁波seo推广推荐
  • 做珠宝网站公司seo的中文是什么
  • 前台网站开发流程优化四个方法
  • 求职简历免费模板抖音seo关键词优化排名
  • 广东省住房和建设局网站网络优化工程师吃香吗
  • 2000做网站贵么推广员是干什么的
  • 团购网站建设流程哪里有网络推广
  • 乐清 做网站 多少钱凡科建站客服电话
  • 广州新塘网站建设推广公司seo是什么学校
  • 深圳做网站佰达科技三十百度快照入口
  • 做app布局参考哪个网站百度知道官网
  • 永康市建设局网站百度官网链接
  • 求推荐专门做借条的网站小红书推广方式有哪些
  • 深圳通公司网站线上广告宣传方式有哪些
  • 怎么做营销网站推广百度搜索一下
  • 做调查问卷网挣钱的网站百度热搜榜怎么打开
  • 自己创业做原公司一样的网站百度框架户一级代理商
  • 动漫设计与制作专业学什么代码优化
  • 做网站分几种广告词
  • 京东购物商城淘宝关键词优化技巧教程
  • 海淀区网站建设百度在线客服
  • 世安建设集团有限公司网站bt兔子磁力搜索引擎最新版
  • 网站美工和平面设计师江苏seo平台
  • wordpress主题qux_v7.1网站seo关键词排名
  • 做推广要知道的网站线下推广方式都有哪些