일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
- CSV
- Request.Form
- .csv
- 한글깨짐
- 업비트
- python
- 초딩수학
- 세로 스크롤 막대
- MSSQL
- 가로 스크롤 막대
- Banker's rounding
- chart.js
- 스크롤 사라짐
- rounding
- LEFT JOIN
- Oracle
- Excel
- swift 화면전환
- 나만의 상점
- 일본여행
- league of legends
- Banker's
- MS-SQL
- Android
- 시트 탭 사라짐
- 썸머노트
- Kakao API Address
- Aspose.cells
- MYSQL
- upbit
- Today
- Total
DBA
Kakao API : address 응답 JSON을 Swift Structure로 만들기 본문
요청 주소 : 서울 강남구 역삼동
[JSON Result]
{
"documents": [
{
"address": {
"address_name": "서울 강남구 역삼동",
"b_code": "1168010100",
"h_code": "",
"main_address_no": "",
"mountain_yn": "N",
"region_1depth_name": "서울",
"region_2depth_name": "강남구",
"region_3depth_h_name": "",
"region_3depth_name": "역삼동",
"sub_address_no": "",
"x": "127.03306536185",
"y": "37.4953666908089"
},
"address_name": "서울 강남구 역삼동",
"address_type": "REGION",
"road_address": null,
"x": "127.03306536185",
"y": "37.4953666908089"
},
{
"address": {
"address_name": "서울 강남구 역삼1동",
"b_code": "",
"h_code": "1168064000",
"main_address_no": "",
"mountain_yn": "N",
"region_1depth_name": "서울",
"region_2depth_name": "강남구",
"region_3depth_h_name": "역삼1동",
"region_3depth_name": "",
"sub_address_no": "",
"x": "127.033201083326",
"y": "37.4954171091244"
},
"address_name": "서울 강남구 역삼1동",
"address_type": "REGION",
"road_address": null,
"x": "127.033201083326",
"y": "37.4954171091244"
},
{
"address": {
"address_name": "서울 강남구 역삼2동",
"b_code": "",
"h_code": "1168065000",
"main_address_no": "",
"mountain_yn": "N",
"region_1depth_name": "서울",
"region_2depth_name": "강남구",
"region_3depth_h_name": "역삼2동",
"region_3depth_name": "",
"sub_address_no": "",
"x": "127.046839198832",
"y": "37.4959639052057"
},
"address_name": "서울 강남구 역삼2동",
"address_type": "REGION",
"road_address": null,
"x": "127.046839198832",
"y": "37.4959639052057"
}
],
"meta": {
"is_end": true,
"pageable_count": 3,
"total_count": 3
}
}
[Swift Structure]
struct SearchResult: Codable {
let documents: [Document]
let meta: Meta
}
struct Document: Codable {
let address: Address
let addressName: String
let addressType: String
let roadAddress: String?
let x: String
let y: String
enum CodingKeys: String, CodingKey {
case address
case addressName = "address_name"
case addressType = "address_type"
case roadAddress = "road_address_name"
case x
case y
}
}
struct Address: Codable {
let addressName: String
let bCode: String
let hCode: String
let mainAddressNo: String
let mountainYN: String
let region1DepthName: String
let region2DepthName: String
let region3DepthHName: String
let region3DepthName: String
let subAddressNo: String
let x: String
let y: String
enum CodingKeys: String, CodingKey {
case addressName = "address_name"
case bCode = "b_code"
case hCode = "h_code"
case mainAddressNo = "main_address_no"
case mountainYN = "mountain_yn"
case region1DepthName = "region_1depth_name"
case region2DepthName = "region_2depth_name"
case region3DepthHName = "region_3depth_h_name"
case region3DepthName = "region_3depth_name"
case subAddressNo = "sub_address_no"
case x
case y
}
}
struct Meta: Codable {
let isEnd: Bool
let pageableCount: Int
let totalCount: Int
enum CodingKeys: String, CodingKey {
case isEnd = "is_end"
case pageableCount = "pageable_count"
case totalCount = "total_count"
}
}