[
{
"login": "mojombo",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://avatars0.githubusercontent.com/u/1?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/mojombo",
"html_url": "https://github.com/mojombo",
"followers_url": "https://api.github.com/users/mojombo/followers",
"following_url": "https://api.github.com/users/mojombo/following{/other_user}",
"gists_url": "https://api.github.com/users/mojombo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/mojombo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/mojombo/subscriptions",
"organizations_url": "https://api.github.com/users/mojombo/orgs",
"repos_url": "https://api.github.com/users/mojombo/repos",
"events_url": "https://api.github.com/users/mojombo/events{/privacy}",
"received_events_url": "https://api.github.com/users/mojombo/received_events",
"type": "User",
"site_admin": false
}
]
json码:https://api.github.com/users
这是api的url。。。我如何解析这个对象来获取数据?
1条答案
按热度按时间sr4lhrrt1#
下面是一个示例,说明如何使用reformation通过array获取json对象。我相信你不会有麻烦改变它与你的数据。
示例.java
乘客.java
下面是根据您在问题中提供的回答生成的类。您可以使用此链接为json响应生成pojo类。json到pojo
添加此渐变:
初始化gson buildr:
使用gson解析json
以下是使用gson解析json的基本步骤。
有关更多信息,请参阅以下文章:
使用gson解析android上的json
或者查看gson官方github存储库
格森