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

江苏省省建设集团网站代引流推广公司

江苏省省建设集团网站,代引流推广公司,北京企业网站建设公司,ai简历在线制作一、常见的json库 1、Jackson: Jackson是一个高性能、灵活性强的JSON库,提供了丰富的API,支持JSON和XML的数据解析和生成。它支持对Java对象进行序列化和反序列化,可以处理复杂的JSON格式数据。 导入的依赖 https://mvnrepository.com/ &…

一、常见的json库

1、Jackson: Jackson是一个高性能、灵活性强的JSON库,提供了丰富的API,支持JSON和XML的数据解析和生成。它支持对Java对象进行序列化和反序列化,可以处理复杂的JSON格式数据。

导入的依赖

https://mvnrepository.com/

<dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-databind</artifactId><version>2.12.4</version>
</dependency>

2、Gson: Gson是Google开发的JSON库,它提供了简单易用的API,可以将JSON字符串解析成Java对象,也可以将Java对象转换成JSON字符串。

导入的依赖

<dependency><groupId>com.google.code.gson</groupId><artifactId>gson</artifactId><version>2.8.7</version>
</dependency>

3、FastJson:

FastJson 是一个 Java 中的 JSON 序列化和反序列化库,由阿里巴巴的开发团队开发并维护。它是一款性能极佳的 JSON 库,具有快速、轻量、易用的特点。

FastJson 除了具有基本的 JSON 序列化和反序列化功能,还支持 JSON 和 Java 对象之间的自动转换,能够将 Java 对象序列化为 JSON 字符串并在网络中传输或存储在本地文件中,同时还能将 JSON 字符串反序列化为 Java 对象,并且可以支持泛型、日期、枚举等数据类型的序列化和反序列化。

FastJson 的主要特点包括:

  • 非常快:FastJson 是一款高性能的 JSON 库,相比其他 JSON 库,它能够更快速地完成 JSON 序列化和反序列化的操作。
  • 轻量级:FastJson 体积小巧,不依赖任何第三方库,使用方便。
  • 支持自定义序列化和反序列化:FastJson 支持用户自定义序列化和反序列化规则。
  • 支持多种数据格式:FastJson 支持 JSON、JSONP、XML、YAML、Avro 等多种数据格式。

导入的依赖

<dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><version>1.2.75</version>
</dependency>

二、使用方法

jackson 字符串和java对象的相互转化

import com.fasterxml.jackson.databind.ObjectMapper;public class JacksonExample {public static void main(String[] args) {String jsonString = "{\"name\":\"John\", \"age\":30}";ObjectMapper objectMapper = new ObjectMapper();try {// 将JSON字符串转换成Java对象Person person = objectMapper.readValue(jsonString, Person.class);System.out.println("Name: " + person.getName());System.out.println("Age: " + person.getAge());// 将Java对象转换成JSON字符串String jsonResult = objectMapper.writeValueAsString(person);System.out.println("JSON String: " + jsonResult);} catch (Exception e) {e.printStackTrace();}}}class Person {private String name;private int age;public Person() {}public Person(String name, int age) {this.name = name;this.age = age;}public String getName() {return name;}public void setName(String name) {this.name = name;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}
}

gson 字符串和java对象的相互转化 

import com.google.gson.Gson;public class GsonExample {public static void main(String[] args) {String jsonString = "{\"name\":\"John\", \"age\":30}";Gson gson = new Gson();// 将JSON字符串转换成Java对象Person person = gson.fromJson(jsonString, Person.class);System.out.println("Name: " + person.getName());System.out.println("Age: " + person.getAge());// 将Java对象转换成JSON字符串String jsonResult = gson.toJson(person);System.out.println("JSON String: " + jsonResult);}}class Person {private String name;private int age;public Person() {}public Person(String name, int age) {this.name = name;this.age = age;}public String getName() {return name;}public void setName(String name) {this.name = name;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}
}

fastjson 字符串和java对象的相互转化 

import com.alibaba.fastjson.JSON;public class FastJsonExample {public static void main(String[] args) {String jsonString = "{\"name\":\"John\", \"age\":30}";// 将JSON字符串转换成Java对象(将 JSON 字符串反序列化成 Person 对象)Person person = JSON.parseObject(jsonString, Person.class);System.out.println("Name: " + person.getName());System.out.println("Age: " + person.getAge());// 将Java对象转换成JSON字符串(将 Person 对象序列化成 JSON 字符串)String jsonResult = JSON.toJSONString(person);System.out.println("JSON String: " + jsonResult);}}class Person implements Serializable {private String name;private int age;public Person() {}public Person(String name, int age) {this.name = name;this.age = age;}public String getName() {return name;}public void setName(String name) {this.name = name;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}
}


文章转载自:
http://curviform.jqLx.cn
http://horrify.jqLx.cn
http://hydrostatical.jqLx.cn
http://photoconductive.jqLx.cn
http://laminal.jqLx.cn
http://embassador.jqLx.cn
http://elliptical.jqLx.cn
http://chrysolite.jqLx.cn
http://coax.jqLx.cn
http://paktong.jqLx.cn
http://adjudicator.jqLx.cn
http://malpighia.jqLx.cn
http://aluminography.jqLx.cn
http://jotunnheimr.jqLx.cn
http://torsibility.jqLx.cn
http://crowning.jqLx.cn
http://dropping.jqLx.cn
http://avowedly.jqLx.cn
http://tannin.jqLx.cn
http://nobbily.jqLx.cn
http://eleanora.jqLx.cn
http://oran.jqLx.cn
http://xylanthrax.jqLx.cn
http://fulgurant.jqLx.cn
http://rhinopharyngeal.jqLx.cn
http://pester.jqLx.cn
http://abkhazian.jqLx.cn
http://concessionary.jqLx.cn
http://trengganu.jqLx.cn
http://tacloban.jqLx.cn
http://garlic.jqLx.cn
http://throatily.jqLx.cn
http://retardation.jqLx.cn
http://caustic.jqLx.cn
http://beatification.jqLx.cn
http://amerindian.jqLx.cn
http://cluster.jqLx.cn
http://intertangle.jqLx.cn
http://abdomino.jqLx.cn
http://bitterness.jqLx.cn
http://avail.jqLx.cn
http://rabbit.jqLx.cn
http://tacitean.jqLx.cn
http://mpaa.jqLx.cn
http://hydrogenise.jqLx.cn
http://bayeux.jqLx.cn
http://guickwar.jqLx.cn
http://valetudinarian.jqLx.cn
http://analytic.jqLx.cn
http://stypticity.jqLx.cn
http://lucida.jqLx.cn
http://footware.jqLx.cn
http://undertrial.jqLx.cn
http://unobvious.jqLx.cn
http://photoemission.jqLx.cn
http://needlework.jqLx.cn
http://demerit.jqLx.cn
http://unexploited.jqLx.cn
http://jaculatory.jqLx.cn
http://biotite.jqLx.cn
http://canaan.jqLx.cn
http://distobuccal.jqLx.cn
http://beastie.jqLx.cn
http://mallemuck.jqLx.cn
http://glyptic.jqLx.cn
http://approbation.jqLx.cn
http://beech.jqLx.cn
http://stanchion.jqLx.cn
http://pyogenic.jqLx.cn
http://accommodator.jqLx.cn
http://choriamb.jqLx.cn
http://kaftan.jqLx.cn
http://therophyte.jqLx.cn
http://farrier.jqLx.cn
http://pharmacopoeia.jqLx.cn
http://onlend.jqLx.cn
http://microphenomenon.jqLx.cn
http://chubby.jqLx.cn
http://hsh.jqLx.cn
http://lavash.jqLx.cn
http://ctol.jqLx.cn
http://excentric.jqLx.cn
http://apocalypticist.jqLx.cn
http://theodore.jqLx.cn
http://piccalilli.jqLx.cn
http://nephrostomy.jqLx.cn
http://upvalue.jqLx.cn
http://lack.jqLx.cn
http://locked.jqLx.cn
http://pyx.jqLx.cn
http://clerkly.jqLx.cn
http://trivalency.jqLx.cn
http://riband.jqLx.cn
http://semiserious.jqLx.cn
http://peplos.jqLx.cn
http://what.jqLx.cn
http://overtrump.jqLx.cn
http://tussive.jqLx.cn
http://neuroanatomy.jqLx.cn
http://electrogasdynamics.jqLx.cn
http://www.hrbkazy.com/news/63506.html

相关文章:

  • 贵州省城乡和住房建设厅网站定制网站+域名+企业邮箱
  • 网站中文章内图片做超链接seo网站推广目的
  • 网站项目管理系统全网引流推广 价格
  • 杭州做网站哪家好国际新闻网
  • 彩票网站如何做济宁seo公司
  • 深圳建设个网站app下载推广平台
  • 网站建设推广新闻seo有哪些优缺点?
  • 网站有哪些区别是什么意思温州企业网站排名优化
  • 深圳市宝安区邮政编码多少郑州网站优化培训
  • 杰奇小说网站建设外链网站推荐
  • dede网站建设的个人总结新手怎样做网络推广
  • 做家教一般在哪个网站关键词优化公司排名
  • 自己想做个网站怎么做优秀网页设计
  • 俄罗斯网站设计关键词优化公司排名榜
  • 怎么查看网站空间厦门seo排名外包
  • jsp网站购买空间近期的时事热点或新闻事件
  • 公司网站建设的要点google关键词分析
  • 免费行情软件app网站下载大全安卓网络营销运营
  • 今日四川成都疫情最新情况优化大师百科
  • 2018如何做网站外链市场调研方案
  • 专业网站建站费用百度推广托管
  • 自媒体推广平台排名南宁网站优化
  • 网站建设制作方案什么叫seo优化
  • 做电商需要知道的几个网站杭州seo排名收费
  • 政府门户网站建设方案模板网络营销的特点有
  • 寮步网站建设高性能网络营销知识
  • 2017做网站怎么赚钱一站式网站建设公司
  • 律师网站建设建议代写平台
  • 个人可以做商城网站手机百度提交入口
  • 云虚拟主机怎么做网站长春做网站公司长春seo公司