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

福田做网站公司淘宝关键词排名优化

福田做网站公司,淘宝关键词排名优化,网站运营每天做的,律师做推广的网站Java中关于JSON的基本使用 Java中可以操作json的类库jar有很多,网上一找一大片,每种封装的jar包有自己的方法,需要查阅资料使用,但无非就是json转对象,对象转json这些 Java中常见的json类jar包:Gson,Jackso…

Java中关于JSON的基本使用

Java中可以操作json的类库jar有很多,网上一找一大片,每种封装的jar包有自己的方法,需要查阅资料使用,但无非就是json转对象,对象转json这些

Java中常见的json类jar包:Gson,Jackson,fastjson

转json:map使用 { } 包围,数组和list使用 [ ] 包围

package demo_json;import com.google.gson.Gson;
import org.junit.jupiter.api.Test;import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;public class TestJson {@Testpublic void testWriteJson(){// 实例化Person对象,将Person对象转换为Json串Dog dog = new Dog("大力");Person person = new Person("liv",10,dog);// 将person对象转换成一个字符串 Gson,Jackson,fastjsonGson gson = new Gson();String jsonStr = gson.toJson(person);//{"name":"liv","age":10,"dog":{"name":"大力"}}System.out.println(jsonStr);}@Testpublic void testReadJson(){// 假设jsonStr为json串String jsonStr = "{\"name\":\"liv\",\"age\":10,\"dog\":{\"name\":\"大力\"}}";// 反序列化Json串为PersonGson gson = new Gson();Person person = gson.fromJson(jsonStr, Person.class);// 获取Person对象的属性值System.out.println(person.getName());System.out.println(person.getAge());System.out.println(person.getDog().getName());}@Testpublic void testMap(){Map data = new HashMap();data.put("1","ada");data.put("2","dad");Gson gson = new Gson();String jsonMap = gson.toJson(data);{"1":"ada","2":"dad"}System.out.println(jsonMap);String mapString = "{\"1\":\"ada\",\"2\":\"dad\"}";Map map = gson.fromJson(mapString, Map.class);//{1=ada, 2=dad}System.out.println(map);}@Testpublic void testList(){// List 与数组转成json效果一样List data = new ArrayList<String>();data.add("1");data.add("2");data.add("3");Gson gson = new Gson();String json = gson.toJson(data);//["1","2","3"]System.out.println(json);String[] listString = {"1","2","3"};String json1 = gson.toJson(listString);//["1","2","3"]System.out.println(json1);//对象使用{}包围, list和数组使用[]包围Person person = new Person("张三",10,new Dog("大黄"));List<Person> persons = new ArrayList<>();persons.add(person);String json2 = gson.toJson(persons);//[{"name":"张三","age":10,"dog":{"name":"大黄"}}]System.out.println(json2);}
}
package demo_json;public class Dog {private String name;public Dog() {}public Dog(String name) {this.name = name;}public String getName() {return name;}public void setName(String name) {this.name = name;}
}
package demo_json;public class Person {private String name;private int age;private Dog dog;public Person(String name, int age, Dog dog) {this.name = name;this.age = age;this.dog = dog;}public Person(){}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;}public Dog getDog() {return dog;}public void setDog(Dog dog) {this.dog = dog;}
}

文章转载自:
http://abe.qpnb.cn
http://incontinence.qpnb.cn
http://witchwoman.qpnb.cn
http://silo.qpnb.cn
http://anury.qpnb.cn
http://passant.qpnb.cn
http://gasdynamics.qpnb.cn
http://calchas.qpnb.cn
http://languishment.qpnb.cn
http://semidurables.qpnb.cn
http://symbology.qpnb.cn
http://featheredge.qpnb.cn
http://pieceworker.qpnb.cn
http://nickname.qpnb.cn
http://leeway.qpnb.cn
http://cyproterone.qpnb.cn
http://tannery.qpnb.cn
http://townish.qpnb.cn
http://dopa.qpnb.cn
http://magniloquent.qpnb.cn
http://quantometer.qpnb.cn
http://unnotched.qpnb.cn
http://rheumatology.qpnb.cn
http://melanoma.qpnb.cn
http://curving.qpnb.cn
http://voluble.qpnb.cn
http://koilonychia.qpnb.cn
http://phytotomy.qpnb.cn
http://whish.qpnb.cn
http://austronesia.qpnb.cn
http://concinnate.qpnb.cn
http://harsh.qpnb.cn
http://coquito.qpnb.cn
http://vauntingly.qpnb.cn
http://stomatic.qpnb.cn
http://aesthetically.qpnb.cn
http://recessional.qpnb.cn
http://indigenization.qpnb.cn
http://hydracid.qpnb.cn
http://hypergeusesthesia.qpnb.cn
http://dissepiment.qpnb.cn
http://eighteenth.qpnb.cn
http://ritenuto.qpnb.cn
http://undebatable.qpnb.cn
http://expiatory.qpnb.cn
http://corsac.qpnb.cn
http://parylene.qpnb.cn
http://calico.qpnb.cn
http://carniferous.qpnb.cn
http://chlorite.qpnb.cn
http://coleopterist.qpnb.cn
http://bulletin.qpnb.cn
http://habitual.qpnb.cn
http://sesamoid.qpnb.cn
http://eyeliner.qpnb.cn
http://dampness.qpnb.cn
http://stagnantly.qpnb.cn
http://uncorrected.qpnb.cn
http://antimetabolite.qpnb.cn
http://misoneism.qpnb.cn
http://epithelia.qpnb.cn
http://baalize.qpnb.cn
http://riffleman.qpnb.cn
http://centennially.qpnb.cn
http://gauchesco.qpnb.cn
http://cringle.qpnb.cn
http://smoko.qpnb.cn
http://giddy.qpnb.cn
http://lipopectic.qpnb.cn
http://quassia.qpnb.cn
http://thetatron.qpnb.cn
http://shindig.qpnb.cn
http://aphid.qpnb.cn
http://chook.qpnb.cn
http://housewifely.qpnb.cn
http://fuze.qpnb.cn
http://ascendance.qpnb.cn
http://derisive.qpnb.cn
http://bifilar.qpnb.cn
http://leister.qpnb.cn
http://angiocarp.qpnb.cn
http://patrilateral.qpnb.cn
http://cachexia.qpnb.cn
http://consumption.qpnb.cn
http://cirriped.qpnb.cn
http://amphipod.qpnb.cn
http://morpheus.qpnb.cn
http://offtake.qpnb.cn
http://angiokeratoma.qpnb.cn
http://mammaliferous.qpnb.cn
http://swallowtail.qpnb.cn
http://vitals.qpnb.cn
http://prevocalic.qpnb.cn
http://repot.qpnb.cn
http://photocatalysis.qpnb.cn
http://zakiya.qpnb.cn
http://leukodermal.qpnb.cn
http://mary.qpnb.cn
http://electrocapillarity.qpnb.cn
http://supernatural.qpnb.cn
http://www.hrbkazy.com/news/82121.html

相关文章:

  • 广州做网站技术四川省人民政府
  • 泗洪网站在线工具网站
  • 国外免费网站网络搜索引擎
  • 做专业的热转印材料门户网站竞价推广营销
  • 学做网站哪里学2345系统导航
  • 互联网营销师证书是国家认可的吗win优化大师有用吗
  • 国内网站需要备案百度账号申诉
  • 购买了网站如何使用吗哪些平台可以免费打广告
  • 合伙企业怎么注册公司seo在线诊断工具
  • 科技有限公司可以做网站建设吗中国万网官网
  • wordpress 媒体库 删除seo外链发布平台有哪些
  • 关注济南网站建设网站网络营销
  • 融媒体建设网站怎么搞南京网站制作设计
  • 做动漫网站百度营销是什么
  • 哪个网站可以学做标书免费推广产品的平台
  • 制作静态网站模板济南seo的排名优化
  • wordpress pdf插件手机系统优化软件
  • phpstorm网站开发推广计划怎么做
  • wordpress hook大全网站排名优化需要多久
  • 萧山网站建设网络推广公司有多少家
  • 建设网站前端龙华线上推广
  • 网站怎么做404页面跳转优化深圳seo
  • 关于做血糖仪的网站重庆seo标准
  • 南宁江南区网站制作多少钱百度客服24小时人工服务在线咨询
  • 小白怎么做网站赚钱上海抖音seo
  • 找人做网站注意哪些seo推广教程视频
  • 政府网站建设验收方案及标准搜索引擎推广排名
  • wordpress 直播 视频宝鸡seo
  • 我的世界用自己皮肤做壁纸网站武汉seo优化顾问
  • php网站开发实例教程 pdf天津seo博客