java从json数组中提取数据,从JSON数组中提取数据

我知道它是一个数组,但是我对JSON完全陌生,需要帮助理解它的结构,这是我提取数据的尝试:

String JSonString = readURL(“//my URL is here”);

JSONArray s = JSONArray.fromObject(JSonString);

JSONObject Data =(JSONObject)(s.getJSONObject(0));

System.out.println(Data.get(“name”));

我拥有的JSON数据如下所示:

{

“sports”: [

{

“name”: “basketball”,

“id”: 40,

“uid”: “s:40”,

“leagues”: [

{

“name”: “National Basketball Assoc.”,

“abbreviation”: “nba”,

“id”: 46,

“uid”: “s:40~l:46”,

“groupId”: 7,

“shortName”: “NBA”,

“athletes”: []

}

]

}

],

“resultsOffset”: 10,

“resultsLimit”: 10,

“resultsCount”: 1,

“timestamp”: “2013-11-18T03:15:43Z”,

“status”: “success”

}

我对这些东西的掌握并不强,因此感谢所有帮助。

    原文作者:流风兮回雪
    原文地址: https://blog.csdn.net/weixin_33489161/article/details/115507611
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞