2017-10-28 2 views
-2

안녕 얘들 아 기본적으로이 json 데이터를 구문 분석하려고합니다.Python : json 목록 구문 분석

[ 
    { 
     "id": 417862, 
     "name": "octokit.rb", 
     "full_name": "octokit/octokit.rb", 
     "owner": { 
      "login": "octokit", 
      "id": 3430433, 
      "avatar_url": "https://avatars0.githubusercontent.com/u/3430433?v=4", 
      "gravatar_id": "", 
      "url": "https://api.github.com/users/octokit", 
      "html_url": "https://github.com/octokit", 
      "followers_url": "https://api.github.com/users/octokit/followers", 
      "following_url": "https://api.github.com/users/octokit/following{/other_user}", 
      "gists_url": "https://api.github.com/users/octokit/gists{/gist_id}", 
      "starred_url": "https://api.github.com/users/octokit/starred{/owner}{/repo}", 
      "subscriptions_url": 
     } ] 

내 질문은 내가 JSON에서

감사 "id": 417862의 값을 얻는 방법이다. 에 대해 어떻게

+0

어떤 프로그래밍 언어/라이브러리를 사용하고 있습니까? –

+0

파이썬을 사용하고 있습니다! – prime

+1

[JSON 파일의 구문 분석 값?] (https://stackoverflow.com/questions/2835559/parsing-values-from-a-json-file)의 가능한 복제본 –

답변

0

:

mylist = [{ 
    "id": 417862, 
    "name": "octokit.rb", 
    "full_name": "octokit/octokit.rb", 
    "owner": { 
    "login": "octokit", 
    "id": 3430433, 
    "avatar_url": "https://avatars0.githubusercontent.com/u/3430433?v=4", 
    "gravatar_id": "", 
    "url": "https://api.github.com/users/octokit", 
    "html_url": "https://github.com/octokit", 
    "followers_url": "https://api.github.com/users/octokit/followers", 
    "following_url": "https://api.github.com/users/octokit/following{/other_user}", 
    "gists_url": "https://api.github.com/users/octokit/gists{/gist_id}", 
    "starred_url": "https://api.github.com/users/octokit/starred{/owner}{/repo}", 
    "subscriptions_url": "cats" 
    } 
}] 

print mylist[0]['id'] 

이 반환은 417862 동일 0 번째의 id 속성 mylist의 (즉, 첫 번째) 멤버를 인쇄합니다.