java解析json对象_JAVA解析JSON数据

在使用第三方api的使用,有时候会从网络中获得json数据,所以说我们将如何解析json数据?

下面小编将通过以下几点来进行json的讲解

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of theJavaScript Programming Language,Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.

31859a7919c3b8bc6736b8a292a5f03b.png

cc269ce6a6235842c57862d96620bbe7.png

2.Json数据类型

2-1.json对象

056dedb41a1101807e2d5814c4aad06a.png

2-2.json数组

a3e3ecd7e17f982a9ad53c9ef0b4ce34.png

ps:JSONObject与JSONArray的区别

6c9430599e1367d1bd824b2024f67ba8.png(JSON数组)

300930a13e99c7ab3922096f116115fa.png(JSON数组)

3.解析JSON数据(小编使用的GSON进行json数据的解析)

3-1 【JSONObject的解析】

下面是一个json文件:

{

"resultcode": "200",

"reason": "successed!",

"result": {

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值