为了账号安全,请及时绑定邮箱和手机立即绑定
慕课网数字资源数据库体验端
JSON快速入门(Java版)_学习笔记_慕课网
为了账号安全,请及时绑定邮箱和手机立即绑定

JSON快速入门(Java版)

李广
难度初级
时长 1小时12分
  • https://img1.sycdn.imooc.com//5b0a181a0001a2e204750291.jpg

    这是一个标准的json格式

    查看全部
    0 采集 收起 来源:JSON数据演示

    2018-05-27

  • 使用JSONArray来获取数组

    查看全部
    0 采集 收起 来源:从文件读取JSON

    2018-05-25

  • json-表示数组

    使用中括号来起始,并用逗号进行分割

    查看全部
    0 采集 收起 来源:数据类型表示

    2018-05-25

  • 数据结构-object

    查看全部
    0 采集 收起 来源:数据类型表示

    2018-05-25

  • 标准json数据标识

    基本类型:string,number,true,false,null

    查看全部
    0 采集 收起 来源:数据类型表示

    2018-05-25

  • json:轻量级的数据格式
    查看全部
    0 采集 收起 来源:什么是JSON

    2018-05-11

  • json:轻量级的数据格式
    查看全部
    0 采集 收起 来源:什么是JSON

    2018-05-11

  • 从文件中读取JSON

    1. 首先读取文件

    2. 把文件转化为String类型的

    3. 构建JSONObject对象读取相关的属性

    查看全部
    0 采集 收起 来源:从文件读取JSON

    2018-05-09

  • 使用javabean构建JSON对象,好处:业务对象可以重用,

    1. 在一个类中创建JavaBean对象,

    2. 在其他类中调用直接初始化javabean对象使用。

    3. 好处就是可以重用javaBean对象

    查看全部
  • 构建JSON对象主要通过2种方法:

    1. JsonObject duixiangming=new JsonObject();

    2. Map<String ,Object> duixingming=new Map<String Object>;

    3. 当使用Map这种方法构建对象时,如果要输出,则需要进行转化。

    查看全部
  • JSON中没有日期的格式,有String,  false null等基本的数据类型。

    想要表示日期,就要用字符串来表示

    查看全部
    0 采集 收起 来源:JSON数据演示

    2018-05-06

  • 谷歌的Gson强大之处可以正向生成反向解析

    查看全部
    0 采集 收起 来源:GSON解析

    2018-04-30

  • 判断Json数据中是否有指定的信息 JSONObject jsonObject = new JSONObject(content); if (!jsonObject.isNull("name")) System.out.println("姓名:" + jsonObject.getString("name")); if (!jsonObject.isNull("age")) System.out.println("年龄:" + jsonObject.getDouble("age")); if (!jsonObject.isNull("birthday")) System.out.println("生日:" + jsonObject.getString("birthday")); if (!jsonObject.isNull("school")) System.out.println("学校:" + jsonObject.getString("school"));

    查看全部
  • 解析json:  pom.xml里一个依赖 commons-io 从文件中间读取json内容 // 声明这个文件 File file = new File(ReadJSONSample.class.getResource("/wangxiaoer.json").getFile()); //通过依赖  FileUtils   String content = FileUtils.readFileToString(file); //通过 JSONObject 这个对象进行处理 JSONObject jsonObject = new JSONObject(content);

    如何解释Json数据 JSONObject json=new JSONObject(content); System.out.println("姓名:"+json.getString("name")); Sytem.out.println("年龄:"+json.getInt("age")); System.out.println("是否有车:"+json.getBoolean("car")); JSONArray array=json.getJSONArray("major"); for(int I=0;i<array.length();I++) { String s=(String)array.get(I); System.outprintln("专业:"+(I+1)+m)); }

    查看全部
    3 采集 收起 来源:从文件读取JSON

    2018-04-29

  • 使用Bean实现Json Bean Class: public class DaShen {   private Stringname;   private Stringschool;   private boolean has_girlfriend;   private double age;   private Objectcar;   private Objecthouse;   private String[]major;   private Stringcomment;   private String birthday; } 实现:   private static void createJsonByBean()   {      DaShen terence=newDaShen();      terence.setAge(25.9);      terence.setBirthday("1990-5-9");      terence.setSchool("HDU");      terence.setMajor(new String[]{"Computer","qiqiqiqi"});      terence.setHas_girlfriend(false);      terence.setComment("sha,sha,sha,sha……");      terence.setCar(null);      terence.setHouse(null);      System.out.println(new JSONObject(terence));   }

    查看全部

举报

0/150
提交
取消
课程须知
学习本门课程前,需要对Java基础知识有所了解呦!
老师告诉你能学到什么?
1、能够使用JSON进行数据的生成和解析 2、能够使用GSON进行数据的生存和解析
友情提示:

您好,此课程属于迁移课程,您已购买该课程,无需重复购买,感谢您对慕课网的支持!