This json file:
[ {
"irc_server" : null,
"ssh_keys" : [ ],
"branches" : {
"master" : {
"running_builds" : [ ],
"recent_builds" : [ {
"outcome" : "no_tests",
"status" : "no_tests",
"build_num" : 1,
"vcs_revision" : "748f8679cfc850582e3ada08210d8566a291328c",
"pushed_at" : "2017-07-21T03:39:46.230Z",
"added_at" : "2017-07-21T03:36:24.657Z"
} ],
"last_non_success" : {
"outcome" : "no_tests",
"status" : "no_tests",
"build_num" : 1,
"vcs_revision" : "748f8679cfc850582e3ada08210d8566a291328c",
"pushed_at" : "2017-07-21T03:39:46.230Z",
"added_at" : "2017-07-21T03:36:24.657Z"
}
}
}]
How I parse it:
projectsurl = get(API_PATH['PROJECTS'].format(self._token)) #get json data from url
decodedjson = projectsurl.content.decode('utf-8') #decode to string
jsondata = json.loads(decodedjson) #json obj
return jsondata['vcs_revision']
How can i get a specific object from this array? Whenever I call return jsondata['vcs_revision'] It says i need an int not a string