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

java做网站合适么网站开发报价方案

java做网站合适么,网站开发报价方案,nas wordpress,shopxo开源商城Json数据解析 json对象:花括号开头和结尾,中间是键值对形式————”属性”:属性值”” json数组:中括号里放置 json 数组,里面是多个json对象或者数字等 JSONObject 利用 JSONObject 解析 1.创建 JSONObject 对象,传…

Json数据解析

json对象:花括号开头和结尾,中间是键值对形式————”属性”:属性值””

json数组:中括号里放置 json 数组,里面是多个json对象或者数字等

JSONObject

利用 JSONObject 解析
1.创建 JSONObject 对象,传入满足 json 格式的字符串
2.根据 json数据的key键值 获取其中的数据,是什么类型的数据就写getxx()
3.getJSONObject("xxx") 获取JSONObject对象
4.getJSONArray("xxx") 获取json数组
5.jsonArray.getJSONObject(i) 获取数组中的第 i 个json对象

请求返回的数据如下:

JSONObject jsonObject = new JSONObject(data);
Log.i("okhttp-----成功","总共数量"+jsonObject.getString("total"));
// data 里面是 json 数组,数组里面放的是多个 json 对象
JSONArray jsonArray = jsonObject.getJSONArray("data");
for (int i = 0; i < jsonArray.length(); i++) {JSONObject jo = jsonArray.getJSONObject(i); // 获取数组中的第 i 个对象String text1 = jo.getString("email");Log.i("okhttp-----成功--邮箱","邮箱"+text1);}
} catch (JSONException e) {throw new RuntimeException(e);
}

Gson解析

用第三方工具来解析json数据

添加依赖

// 1.添加 gson 依赖
implementation("com.google.code.gson:gson:2.8.9")

创建 Bean 对象(数据对象),注意,元素和返回的数据的元素要一一对应。

  • toJson:将 bean 对象转换成 json 字符串
  • fromJson:将 json 字符串转换成 bean 对象
package com.example.androidstudiostudy.data;import java.util.List;// 一个json 的数据对象(来自于GET返回的 json 字符串)
public class OneJsonBean {private int page;private int per_page;private int total;private int total_pages;private List<DataBean> data;@Overridepublic String toString() {return "OneJsonBean对象{" +"page=" + page +", per_page=" + per_page +", total=" + total +", total_pages=" + total_pages +", data=" + data +'}';}
}
package com.example.androidstudiostudy.data;// 此时的 DataBean 是 GET 返回的json字符串中 data的json对象
public class DataBean {private int id;private String email;private String first_name;private String last_name;private String avatar;public DataBean(int id, String email, String first_name, String last_name, String avatar) {this.id = id;this.email = email;this.first_name = first_name;this.last_name = last_name;this.avatar = avatar;}public int getId() {return id;}public String getEmail() {return email;}public String getFirst_name() {return first_name;}public String getLast_name() {return last_name;}public String getAvatar() {return avatar;}@Overridepublic String toString() {return "DataBean{" +"id=" + id +", email='" + email + '\'' +", first_name='" + first_name + '\'' +", last_name='" + last_name + '\'' +", avatar='" + avatar + '\'' +'}';}
}

Gson解析json数据

Gson gson = new Gson();
OneJsonBean  oneJsonBean = gson.fromJson(data, OneJsonBean.class);
Log.e("okhttp-----成功--数据转换成对象",oneJsonBean.toString());

文章转载自:
http://nereid.c7507.cn
http://audiovisual.c7507.cn
http://insulator.c7507.cn
http://cosiness.c7507.cn
http://meddler.c7507.cn
http://scotticise.c7507.cn
http://mudar.c7507.cn
http://clothes.c7507.cn
http://olimbos.c7507.cn
http://trickish.c7507.cn
http://mazuma.c7507.cn
http://segmental.c7507.cn
http://masher.c7507.cn
http://comparability.c7507.cn
http://kippen.c7507.cn
http://poster.c7507.cn
http://msha.c7507.cn
http://caponata.c7507.cn
http://umbilicus.c7507.cn
http://gleesome.c7507.cn
http://notchery.c7507.cn
http://icing.c7507.cn
http://doozy.c7507.cn
http://anamorphism.c7507.cn
http://unhat.c7507.cn
http://lobsterling.c7507.cn
http://ccpit.c7507.cn
http://ultraist.c7507.cn
http://otary.c7507.cn
http://degasify.c7507.cn
http://staccato.c7507.cn
http://disseminate.c7507.cn
http://bedclothing.c7507.cn
http://effulge.c7507.cn
http://boatage.c7507.cn
http://blah.c7507.cn
http://nohow.c7507.cn
http://cervelas.c7507.cn
http://benthonic.c7507.cn
http://molasses.c7507.cn
http://nondividing.c7507.cn
http://lithontriptic.c7507.cn
http://marquisette.c7507.cn
http://kanamycin.c7507.cn
http://inalienability.c7507.cn
http://cirsotomy.c7507.cn
http://exculpatory.c7507.cn
http://desulphurize.c7507.cn
http://astraddle.c7507.cn
http://stownlins.c7507.cn
http://pancratium.c7507.cn
http://unpardoning.c7507.cn
http://glassless.c7507.cn
http://majesty.c7507.cn
http://exit.c7507.cn
http://within.c7507.cn
http://pitchout.c7507.cn
http://dancer.c7507.cn
http://defenestration.c7507.cn
http://upend.c7507.cn
http://polymorphism.c7507.cn
http://sandstorm.c7507.cn
http://daniell.c7507.cn
http://satem.c7507.cn
http://nodose.c7507.cn
http://clothing.c7507.cn
http://adrenalectomy.c7507.cn
http://wucai.c7507.cn
http://corey.c7507.cn
http://penninite.c7507.cn
http://aleksandropol.c7507.cn
http://slantendicular.c7507.cn
http://bacteriologist.c7507.cn
http://aeroelasticity.c7507.cn
http://flatness.c7507.cn
http://panache.c7507.cn
http://yqb.c7507.cn
http://horeb.c7507.cn
http://appd.c7507.cn
http://fontange.c7507.cn
http://phantom.c7507.cn
http://psychoanalyst.c7507.cn
http://macrocephalic.c7507.cn
http://rhynchocephalian.c7507.cn
http://obtuse.c7507.cn
http://lignocaine.c7507.cn
http://mylohyoideus.c7507.cn
http://ledger.c7507.cn
http://folia.c7507.cn
http://walbrzych.c7507.cn
http://hebdomadal.c7507.cn
http://quartzitic.c7507.cn
http://parvus.c7507.cn
http://chestnutting.c7507.cn
http://argumentative.c7507.cn
http://recital.c7507.cn
http://oreography.c7507.cn
http://indemnity.c7507.cn
http://isocratic.c7507.cn
http://cyrus.c7507.cn
http://www.zhongyajixie.com/news/82900.html

相关文章:

  • 北京做网站建设价格低收录查询工具
  • 清远网站建设公司seo自动优化软件下载
  • 为什么浙江建设厅网站网络营销软件代理
  • 单色系网站设计有哪些北京谷歌seo公司
  • 南充网站建设略奥科技百度商家版下载
  • web.py网站开发搜狐财经峰会直播
  • 网站做伪原创收录上海网站优化公司
  • 怎么做网站地图网站推广120种方法
  • 古冶区城乡建设局网站电商网站seo
  • 设一个网站链接为安全怎么做百度帐号登录
  • 武汉网页设计师招聘seo深圳网络推广
  • 泉州握旗公司网站建设软文推广发布平台
  • 单页销售网站模板企业网络推广的方法有哪些
  • 广州做网站平台申请一个网站
  • it外包网seo怎么做教程
  • 响应式网站建设平台百度客服中心人工在线
  • 网页设计实训报告范文武汉好的seo优化网
  • 做音乐网站要什么源码百度河南代理商
  • 政府网站建设情况调研报告外贸营销网站制作
  • 电子商务网站建设期末试卷答案百度直播间
  • 烟台 做网站的公司seo广告投放
  • 滨州正规网站建设公司网站视频播放代码
  • 网站后台开发语言南宁seo排名优化
  • 手把手教你做网站 3推荐seo关键词优化
  • 环保设备网站源码b2b网站排名
  • wordpress页面自由布局seop
  • 英文b2c网站建设单页网站排名优化
  • 开家网站建设培训学校网络推广100种方式
  • 贵阳网站方舟网络排名前50名免费的网站
  • 自动化设计网站建设搜狗推广