Как извлечь только то, что мне нужно, из файла JSON, отправленного API при весенней загрузке
Я получил отзыв от веб-крючка gitlab, и я хотел извлечь некоторые конкретные данные из API. Я хотел бы знать, как извлечь именно то, что мне нужно, из файла JSON, отправленного API при весенней загрузке. Мой вывод похож на это:
{
"object_kind": "push",
"event_name": "push",
"before": "102506edc4b347277e80cce2acf3bd68748cf36c",
"after": "102506edc4b347277e80cce2acf3bd68748cf36c",
"ref": "refs/heads/master",
"checkout_sha": "102506edc4b347277e80cce2acf3bd68748cf36c",
"message": null,
"user_id": 3141711,
"user_name": "eeeeeeee",
"user_username": "eeeeeeeeeeeee",
"user_email": "",
"user_avatar": "https://assets.gitlab-
static.net/uploads/-/system/user/avatar/3141711/avatar.png",
"project_id": 11096133,
"project": {
"id": 11096133,
"name": "testHooks",
"description": "",
"web_url": "https://gitlab.com/***********/testhooks",
"avatar_url": null,
"git_ssh_url": "git@gitlab.com:***************/testhooks.git",
"git_http_url": "https://gitlab.com/*********/testhooks.git",
"namespace": "*************",
"visibility_level": 0,
"path_with_namespace": "********/testhooks",
"default_branch": "master",
"ci_config_path": null,
"homepage": "https://gitlab.com/c*******i/testhooks",
"url": "git@gitlab.com:c*******i/testhooks.git",
"ssh_url": "git@gitlab.com:c********i/testhooks.git",
"http_url": "https://gitlab.com/********i/testhooks.git"
},
"commits": [
{
"id": "102506edc4b347277e80cce2acf3bd68748cf36c",
"message": "first hook try\n",
"timestamp": "2019-03-01T13:24:53Z",
"url":
" https://gitlab.com/c************ hi / testhooks / commit / 102506edc4b347277e80cce2a cf3bd68748cf36c", "author": {"name": "******** ******** "," электронная почта ": "****************@gmail.com" }, " добавлено ": [ "***************.txt" ], " модифицированный ": [
],
"removed": [
]
}
],
"total_commits_count": 1,
"push_options": [
],
"repository": {
"name": "testHooks",
"url": "git@gitlab.com:*************/testhooks.git",
"description": "",
"homepage": "https://gitlab.com/*********/testhooks",
"git_http_url": "https://gitlab.com/********/testhooks.git",
"git_ssh_url": "gititlab.com:**********/testhooks.git",
"visibility_level": 0
}``
}
и я хочу извлечь Nommits и timestamp