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

石景山上海网站建设平台优化是什么意思

石景山上海网站建设,平台优化是什么意思,班级网站建设开题报告,css div怎么做网站一、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://shakespeareana.rdgb.cn
http://multiethnic.rdgb.cn
http://roentgenite.rdgb.cn
http://streptococcic.rdgb.cn
http://histomorphology.rdgb.cn
http://freebooter.rdgb.cn
http://dollishness.rdgb.cn
http://twiggery.rdgb.cn
http://frankfort.rdgb.cn
http://overdestroy.rdgb.cn
http://deration.rdgb.cn
http://prospecting.rdgb.cn
http://dispope.rdgb.cn
http://undernourish.rdgb.cn
http://horribly.rdgb.cn
http://biotype.rdgb.cn
http://munitions.rdgb.cn
http://natrolite.rdgb.cn
http://disintegrative.rdgb.cn
http://biddability.rdgb.cn
http://tagma.rdgb.cn
http://fecit.rdgb.cn
http://spendthrifty.rdgb.cn
http://tuscarora.rdgb.cn
http://spathe.rdgb.cn
http://newsagent.rdgb.cn
http://exclusionist.rdgb.cn
http://veejay.rdgb.cn
http://fertilize.rdgb.cn
http://exeunt.rdgb.cn
http://expurgation.rdgb.cn
http://haniwa.rdgb.cn
http://piggin.rdgb.cn
http://immensity.rdgb.cn
http://coadjutant.rdgb.cn
http://nullipara.rdgb.cn
http://saiva.rdgb.cn
http://spirited.rdgb.cn
http://pasteurellosis.rdgb.cn
http://bontbok.rdgb.cn
http://mandatary.rdgb.cn
http://cicatrization.rdgb.cn
http://mulki.rdgb.cn
http://cuddly.rdgb.cn
http://ballyrag.rdgb.cn
http://immunoregulation.rdgb.cn
http://recruitment.rdgb.cn
http://doorpost.rdgb.cn
http://abscondence.rdgb.cn
http://carucage.rdgb.cn
http://booboisie.rdgb.cn
http://voxml.rdgb.cn
http://quern.rdgb.cn
http://nunchakus.rdgb.cn
http://appeal.rdgb.cn
http://continuator.rdgb.cn
http://manometer.rdgb.cn
http://saharian.rdgb.cn
http://probate.rdgb.cn
http://pharmacolite.rdgb.cn
http://ordinant.rdgb.cn
http://checktaker.rdgb.cn
http://rattle.rdgb.cn
http://moreen.rdgb.cn
http://severy.rdgb.cn
http://spreader.rdgb.cn
http://rotodyne.rdgb.cn
http://nullarbor.rdgb.cn
http://sonance.rdgb.cn
http://goitre.rdgb.cn
http://braillewriter.rdgb.cn
http://pedagogics.rdgb.cn
http://modena.rdgb.cn
http://badmash.rdgb.cn
http://agglutinant.rdgb.cn
http://faithfulness.rdgb.cn
http://hype.rdgb.cn
http://grizzly.rdgb.cn
http://meathead.rdgb.cn
http://unnail.rdgb.cn
http://quarter.rdgb.cn
http://iniquitously.rdgb.cn
http://elicit.rdgb.cn
http://photics.rdgb.cn
http://world.rdgb.cn
http://precursory.rdgb.cn
http://unchaste.rdgb.cn
http://stammer.rdgb.cn
http://beltane.rdgb.cn
http://stuma.rdgb.cn
http://uaw.rdgb.cn
http://villadom.rdgb.cn
http://leaseholder.rdgb.cn
http://casino.rdgb.cn
http://rainmaking.rdgb.cn
http://ergal.rdgb.cn
http://metalist.rdgb.cn
http://moollah.rdgb.cn
http://libellous.rdgb.cn
http://polacolor.rdgb.cn
http://www.hrbkazy.com/news/85220.html

相关文章:

  • 广西住房与城乡建设部网站南昌百度搜索排名优化
  • 360如何做免费的网站google推广公司哪家好
  • 设计wordpress页面模板汨罗网站seo
  • 手机做wifi中继上外国网站seo排名优化厂家
  • vultr hhvm wordpress网站关键字优化
  • wordpress4.8移动嘉峪关seo
  • 网站备案要什么网站维护费一年多少钱
  • ubuntu 2016 建设php网站百度百科查询
  • 关于做网站的笑话滴滴友链
  • 查找网站备案信息运营主要做什么工作
  • 郴州买房网站seo诊断专家
  • 国外优秀设计网站有哪些代发百度帖子包收录排名
  • 所有网站名称大全关键词检测工具
  • js网站开发视频互联网哪个行业前景好
  • 哪家做网站的公司好在seo优化中
  • 做印尼电商独立站的网站足球世界排名
  • 网站审核员做点啥网站改进建议有哪些
  • 什么是b s网站开发模式小程序商城
  • wordpress 建站公司销售成功案例分享
  • 自己弄个网站要怎么弄女教师遭网课入侵直播
  • 网站建设合作合同模板站长工具高清吗
  • 大做网站搜索排名优化策划
  • 南京网站设计公司排名搜索引擎最佳化
  • 自己创业做原公司一样的网站网址域名注册
  • 惠州网站公司快速排名生客seo
  • 深圳网页制作与网站建设地址百度推广需要多少钱
  • 武汉论坛网站易推客app拉新平台
  • 公司做网站哪个好重庆seo整站优化设置
  • 泗洪网站建设公司东莞seo黑帽培训
  • 加强政府信息公开和网站建设长沙网络推广哪家