查询嵌套 JSON 中的项目
Query an item in a nested JSON
我试图查询 JSON 中的值。我必须向 API 发送 GET 请求以使用 url.
中的参数检索该数据
如何检索国家/地区 = 法国的记录?我应该在 URL 的查询部分添加什么来检索属于法国国家/地区的记录?
{
"results": [
{
"gender": "female",
"name": {
"title": "Ms",
"first": "Marsha",
"last": "Jacobs"
},
"location": {
"street": {
"number": 673,
"name": "White Oak Dr"
},
"city": "Saginaw",
"state": "South Dakota",
"country": "United States",
"postcode": 73528,
"coordinates": {
"latitude": "88.6549",
"longitude": "58.0396"
},
"timezone": {
"offset": "-2:00",
"description": "Mid-Atlantic"
}
},
"email": "marsha.jacobs@example.com",
"login": {
"uuid": "7e61fccb-aa06-48c9-a112-03f2e9860029",
"username": "bigcat139",
"password": "batman",
"salt": "QOayHXLQ",
"md5": "8ef57655311d2e90092066bc69e054c6",
"sha1": "f094b59680a5e0377db706c0c3bccb4afd7fe055",
"sha256": "9d5d62039ccbb59144b1358c65d8a4114a135a80119400f23f2fce4d93713545"
},
"dob": {
"date": "1957-07-26T05:27:00.832Z",
"age": 64
},
"registered": {
"date": "2019-09-25T12:30:37.247Z",
"age": 2
},
"phone": "(965)-400-1668",
"cell": "(108)-397-9370",
"id": {
"name": "SSN",
"value": "919-74-7855"
},
"picture": {
"large": "https://randomuser.me/api/portraits/women/17.jpg",
"medium": "https://randomuser.me/api/portraits/med/women/17.jpg",
"thumbnail": "https://randomuser.me/api/portraits/thumb/women/17.jpg"
},
"nat": "US"
}
],
"info": {
"seed": "a6df1899c0e0a96b",
"results": 1,
"page": 1,
"version": "1.3"
}
}
几次尝试后找到了!使用“nat”键值对来获取所需的记录!
GET {{baseURL}}/api?nat="FR"
我试图查询 JSON 中的值。我必须向 API 发送 GET 请求以使用 url.
中的参数检索该数据如何检索国家/地区 = 法国的记录?我应该在 URL 的查询部分添加什么来检索属于法国国家/地区的记录?
{
"results": [
{
"gender": "female",
"name": {
"title": "Ms",
"first": "Marsha",
"last": "Jacobs"
},
"location": {
"street": {
"number": 673,
"name": "White Oak Dr"
},
"city": "Saginaw",
"state": "South Dakota",
"country": "United States",
"postcode": 73528,
"coordinates": {
"latitude": "88.6549",
"longitude": "58.0396"
},
"timezone": {
"offset": "-2:00",
"description": "Mid-Atlantic"
}
},
"email": "marsha.jacobs@example.com",
"login": {
"uuid": "7e61fccb-aa06-48c9-a112-03f2e9860029",
"username": "bigcat139",
"password": "batman",
"salt": "QOayHXLQ",
"md5": "8ef57655311d2e90092066bc69e054c6",
"sha1": "f094b59680a5e0377db706c0c3bccb4afd7fe055",
"sha256": "9d5d62039ccbb59144b1358c65d8a4114a135a80119400f23f2fce4d93713545"
},
"dob": {
"date": "1957-07-26T05:27:00.832Z",
"age": 64
},
"registered": {
"date": "2019-09-25T12:30:37.247Z",
"age": 2
},
"phone": "(965)-400-1668",
"cell": "(108)-397-9370",
"id": {
"name": "SSN",
"value": "919-74-7855"
},
"picture": {
"large": "https://randomuser.me/api/portraits/women/17.jpg",
"medium": "https://randomuser.me/api/portraits/med/women/17.jpg",
"thumbnail": "https://randomuser.me/api/portraits/thumb/women/17.jpg"
},
"nat": "US"
}
],
"info": {
"seed": "a6df1899c0e0a96b",
"results": 1,
"page": 1,
"version": "1.3"
}
}
几次尝试后找到了!使用“nat”键值对来获取所需的记录!
GET {{baseURL}}/api?nat="FR"