質問編集履歴
3
自分で試したことを追記しました
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
swiftで
|
1
|
+
swiftでCodableの組み立て方がわからない。
|
test
CHANGED
@@ -1,417 +1,383 @@
|
|
1
1
|
楽天トラベルAPUを使ったAPIリクエストでdecodeに失敗しています。使用言語はswiftです。
|
2
2
|
|
3
|
-
|
3
|
+
おそらく,hotelキーの中が配列になっており、配列の0つ目にhotelBasicInfo,1つ目にhotelRatingInfoが当てられている箇所が原因だと思われます。
|
4
|
+
|
4
|
-
|
5
|
+
自分のコードでは、`let hotel: [HotelInfo]`としていますが、同じ型が配列にまとめられているわけではないため、配列の1つ目であるhotelRatingInfoを見に行ったときにエラーが出てしまいます。
|
6
|
+
|
7
|
+
|
8
|
+
|
5
|
-
|
9
|
+
ワークアラウンドとして`let info: HotelValue`の箇所を`let info: HotelValue?`とおいて、nullを許可すれば大丈夫だったのですが、何かすっきりしないやり方です。
|
10
|
+
|
11
|
+
|
12
|
+
|
6
|
-
|
13
|
+
他の方法を思いついた方がいればぜひご教授お願いしたいです。
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
swift側でのCodableの定義
|
20
|
+
|
7
|
-
|
21
|
+
```swift
|
22
|
+
|
23
|
+
struct Hotels: Codable {
|
24
|
+
|
25
|
+
let hotels: [Hotel]
|
26
|
+
|
27
|
+
}
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
struct Hotel: Codable {
|
32
|
+
|
33
|
+
let hotel: [HotelInfo]
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
struct HotelInfo: Codable {
|
38
|
+
|
39
|
+
let info: HotelValue
|
40
|
+
|
41
|
+
private enum CodingKeys: String, CodingKey {
|
42
|
+
|
43
|
+
case info = "hotelBasicInfo"
|
44
|
+
|
45
|
+
}
|
46
|
+
|
47
|
+
}
|
48
|
+
|
49
|
+
}
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
struct HotelValue: Codable {
|
54
|
+
|
55
|
+
let name: String
|
56
|
+
|
57
|
+
let infoURL: String
|
58
|
+
|
59
|
+
let description: String
|
60
|
+
|
61
|
+
let hotelImageURL: String
|
62
|
+
|
63
|
+
let roomImageURL: String
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
private enum CodingKeys: String, CodingKey {
|
68
|
+
|
69
|
+
case name = "hotelName"
|
70
|
+
|
71
|
+
case infoURL = "hotelInformationUrl"
|
72
|
+
|
73
|
+
case description = "hotelSpecial"
|
74
|
+
|
75
|
+
case hotelImageURL = "hotelImageUrl"
|
76
|
+
|
77
|
+
case roomImageURL = "roomImageUrl"
|
78
|
+
|
79
|
+
}
|
80
|
+
|
81
|
+
}
|
8
82
|
|
9
83
|
```
|
10
84
|
|
11
|
-
|
85
|
+
|
12
|
-
|
13
|
-
|
86
|
+
|
14
|
-
|
15
|
-
- .0 : CodingKeys(stringValue: "hotelBasicInfo", intValue: nil)
|
16
|
-
|
17
|
-
|
87
|
+
レスポンスのjson
|
18
|
-
|
19
|
-
▿ codingPath : 4 elements
|
20
|
-
|
21
|
-
- 0 : CodingKeys(stringValue: "hotels", intValue: nil)
|
22
|
-
|
23
|
-
▿ 1 : _JSONKey(stringValue: "Index 0", intValue: 0)
|
24
|
-
|
25
|
-
- stringValue : "Index 0"
|
26
|
-
|
27
|
-
▿ intValue : Optional<Int>
|
28
|
-
|
29
|
-
- some : 0
|
30
|
-
|
31
|
-
- 2 : CodingKeys(stringValue: "hotel", intValue: nil)
|
32
|
-
|
33
|
-
▿ 3 : _JSONKey(stringValue: "Index 1", intValue: 1)
|
34
|
-
|
35
|
-
- stringValue : "Index 1"
|
36
|
-
|
37
|
-
▿ intValue : Optional<Int>
|
38
|
-
|
39
|
-
- some : 1
|
40
|
-
|
41
|
-
- debugDescription : "No value associated with key CodingKeys(stringValue: \"hotelBasicInfo\", intValue: nil) (\"hotelBasicInfo\")."
|
42
|
-
|
43
|
-
- underlyingError : nil
|
44
88
|
|
45
89
|
```
|
46
90
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
st
|
58
|
-
|
59
|
-
l
|
91
|
+
{
|
92
|
+
|
93
|
+
"pagingInfo": {
|
94
|
+
|
95
|
+
"recordCount": 2309,
|
96
|
+
|
97
|
+
"pageCount": 77,
|
98
|
+
|
99
|
+
"page": 1,
|
100
|
+
|
101
|
+
"first": 1,
|
102
|
+
|
103
|
+
"last": 30
|
104
|
+
|
105
|
+
},
|
106
|
+
|
107
|
+
"hotels": [
|
108
|
+
|
109
|
+
{
|
110
|
+
|
111
|
+
"hotel": [
|
112
|
+
|
113
|
+
{
|
114
|
+
|
115
|
+
"hotelBasicInfo": {
|
116
|
+
|
117
|
+
"hotelNo": 1019,
|
118
|
+
|
119
|
+
"hotelName": "森のスパリゾート 北海道ホテル",
|
120
|
+
|
121
|
+
"hotelInformationUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/JBe8h/?f_no=1019",
|
122
|
+
|
123
|
+
"planListUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/3VTwt/?f_no=1019&f_flg=PLAN",
|
124
|
+
|
125
|
+
"dpPlanListUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/IWrzP/?noTomariHotel=1019",
|
126
|
+
|
127
|
+
"reviewUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/HTX0u/?f_hotel_no=1019",
|
128
|
+
|
129
|
+
"hotelKanaName": "もりのすぱりじーと ほっかいどう",
|
130
|
+
|
131
|
+
"hotelSpecial": "モール温泉浴場を備えた緑に囲まれたシティホテル。全室Wi-fi接続&LANケーブル接続可能",
|
132
|
+
|
133
|
+
"hotelMinCharge": 3780,
|
134
|
+
|
135
|
+
"latitude": 154468.78,
|
136
|
+
|
137
|
+
"longitude": 515524.06,
|
138
|
+
|
139
|
+
"postalCode": "080-0017",
|
140
|
+
|
141
|
+
"address1": "北海道",
|
142
|
+
|
143
|
+
"address2": "帯広市西7条南19丁目1",
|
144
|
+
|
145
|
+
"telephoneNo": "0155-21-0001",
|
146
|
+
|
147
|
+
"faxNo": "0155-25-3721",
|
148
|
+
|
149
|
+
"access": "根室本線JR帯広駅南口から車で5分。帯広空港より車で30分。",
|
150
|
+
|
151
|
+
"parkingInformation": "有り 180台 無料",
|
152
|
+
|
153
|
+
"nearestStation": "帯広",
|
154
|
+
|
155
|
+
"hotelImageUrl": "https://img.travel.rakuten.co.jp/share/HOTEL/1019/1019.jpg",
|
156
|
+
|
157
|
+
"hotelThumbnailUrl": "https://img.travel.rakuten.co.jp/HIMG/90/1019.jpg",
|
158
|
+
|
159
|
+
"roomImageUrl": "https://img.travel.rakuten.co.jp/share/HOTEL/1019/1019_tw1.jpg",
|
160
|
+
|
161
|
+
"roomThumbnailUrl": "https://img.travel.rakuten.co.jp/HIMG/INTERIOR/1019.jpg",
|
162
|
+
|
163
|
+
"hotelMapImageUrl": "https://img.travel.rakuten.co.jp/share/HOTEL/1019/1019map.gif",
|
164
|
+
|
165
|
+
"reviewCount": 1876,
|
166
|
+
|
167
|
+
"reviewAverage": 4.43,
|
168
|
+
|
169
|
+
"userReview": "今回が2回目の宿泊ですが、今回は家族での利用のため、前回よりも広いテラス付きのツインにしました。朝にテラスから庭にいるリスが見れて家族もテンションが上がっていました。朝食も大変美味しく、大浴場も街中の… 2021-10-02 19:54:40投稿 <a href="https://img.travel.rakuten.co.jp/image/tr/api/kw/HTX0u/?f_hotel_no=1019" class="3click">つづきはこちら</a>"
|
170
|
+
|
171
|
+
}
|
172
|
+
|
173
|
+
},
|
174
|
+
|
175
|
+
{
|
176
|
+
|
177
|
+
"hotelRatingInfo": {
|
178
|
+
|
179
|
+
"serviceAverage": 4.27,
|
180
|
+
|
181
|
+
"locationAverage": 4.29,
|
182
|
+
|
183
|
+
"roomAverage": 4.39,
|
184
|
+
|
185
|
+
"equipmentAverage": 4.32,
|
186
|
+
|
187
|
+
"bathAverage": 4.26,
|
188
|
+
|
189
|
+
"mealAverage": 4.42
|
190
|
+
|
191
|
+
}
|
192
|
+
|
193
|
+
}
|
194
|
+
|
195
|
+
]
|
196
|
+
|
197
|
+
},
|
198
|
+
|
199
|
+
{
|
200
|
+
|
201
|
+
"hotel": [
|
202
|
+
|
203
|
+
{
|
204
|
+
|
205
|
+
"hotelBasicInfo": {
|
206
|
+
|
207
|
+
"hotelNo": 1968,
|
208
|
+
|
209
|
+
"hotelName": "北海道第一ホテルサッポロ",
|
210
|
+
|
211
|
+
"hotelInformationUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/JBe8h/?f_no=1968",
|
212
|
+
|
213
|
+
"planListUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/3VTwt/?f_no=1968&f_flg=PLAN",
|
214
|
+
|
215
|
+
"dpPlanListUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/IWrzP/?noTomariHotel=1968",
|
216
|
+
|
217
|
+
"reviewUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/HTX0u/?f_hotel_no=1968",
|
218
|
+
|
219
|
+
"hotelKanaName": "ほっかいどう だいいちほてる さっぽろ",
|
220
|
+
|
221
|
+
"hotelSpecial": "コンビニ隣、飲食店街すぐそば。地下鉄駅、空港連絡バス乗り場まで徒歩1分。",
|
222
|
+
|
223
|
+
"hotelMinCharge": 2250,
|
224
|
+
|
225
|
+
"latitude": 155113.74,
|
226
|
+
|
227
|
+
"longitude": 508850.83,
|
228
|
+
|
229
|
+
"postalCode": "001-0023",
|
230
|
+
|
231
|
+
"address1": "北海道",
|
232
|
+
|
233
|
+
"address2": "札幌市北区北23条西4丁目2-6",
|
234
|
+
|
235
|
+
"telephoneNo": "011-726-3232",
|
236
|
+
|
237
|
+
"faxNo": "011-726-9855",
|
238
|
+
|
239
|
+
"access": "JR札幌駅より地下鉄南北線麻生方面 「北24条駅」下車 → 4番出口徒歩1分。【高速】札樽道 → 北インターから約8分",
|
240
|
+
|
241
|
+
"parkingInformation": "徒歩2,3分の契約駐車場(高さ2.1mまで)1泊900円",
|
242
|
+
|
243
|
+
"nearestStation": "北24条",
|
244
|
+
|
245
|
+
"hotelImageUrl": "https://img.travel.rakuten.co.jp/share/HOTEL/1968/1968.jpg",
|
246
|
+
|
247
|
+
"hotelThumbnailUrl": "https://img.travel.rakuten.co.jp/HIMG/90/1968.jpg",
|
248
|
+
|
249
|
+
"roomImageUrl": "https://img.travel.rakuten.co.jp/share/HOTEL/1968/1968_sgl.jpg",
|
250
|
+
|
251
|
+
"roomThumbnailUrl": "https://img.travel.rakuten.co.jp/HIMG/INTERIOR/1968.jpg",
|
252
|
+
|
253
|
+
"hotelMapImageUrl": "https://img.travel.rakuten.co.jp/share/HOTEL/1968/1968map.gif",
|
254
|
+
|
255
|
+
"reviewCount": 1135,
|
256
|
+
|
257
|
+
"reviewAverage": 3.63,
|
258
|
+
|
259
|
+
"userReview": null
|
260
|
+
|
261
|
+
}
|
262
|
+
|
263
|
+
},
|
264
|
+
|
265
|
+
{
|
266
|
+
|
267
|
+
"hotelRatingInfo": {
|
268
|
+
|
269
|
+
"serviceAverage": 0,
|
270
|
+
|
271
|
+
"locationAverage": 0,
|
272
|
+
|
273
|
+
"roomAverage": 0,
|
274
|
+
|
275
|
+
"equipmentAverage": 0,
|
276
|
+
|
277
|
+
"bathAverage": 0,
|
278
|
+
|
279
|
+
"mealAverage": 0
|
280
|
+
|
281
|
+
}
|
282
|
+
|
283
|
+
}
|
284
|
+
|
285
|
+
]
|
286
|
+
|
287
|
+
},
|
288
|
+
|
289
|
+
{
|
290
|
+
|
291
|
+
"hotel": [
|
292
|
+
|
293
|
+
{
|
294
|
+
|
295
|
+
"hotelBasicInfo": {
|
296
|
+
|
297
|
+
"hotelNo": 68236,
|
298
|
+
|
299
|
+
"hotelName": "北海道の輝き☆ティンクナ",
|
300
|
+
|
301
|
+
"hotelInformationUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/JBe8h/?f_no=68236",
|
302
|
+
|
303
|
+
"planListUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/3VTwt/?f_no=68236&f_flg=PLAN",
|
304
|
+
|
305
|
+
"dpPlanListUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/IWrzP/?noTomariHotel=68236",
|
306
|
+
|
307
|
+
"reviewUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/HTX0u/?f_hotel_no=68236",
|
308
|
+
|
309
|
+
"hotelKanaName": "ほっかいどうのかがやき☆てぃんくな",
|
310
|
+
|
311
|
+
"hotelSpecial": "阿蘇×北海道の創作フレンチが自慢。北海道から移住した夫婦が営む宿",
|
312
|
+
|
313
|
+
"hotelMinCharge": 5780,
|
314
|
+
|
315
|
+
"latitude": 118208.44,
|
316
|
+
|
317
|
+
"longitude": 471872.92,
|
318
|
+
|
319
|
+
"postalCode": "869-1504",
|
320
|
+
|
321
|
+
"address1": "熊本県",
|
322
|
+
|
323
|
+
"address2": "阿蘇郡南阿蘇村大字一関1471-2",
|
324
|
+
|
325
|
+
"telephoneNo": "0967-62-8044",
|
326
|
+
|
327
|
+
"faxNo": "0967-62-8166",
|
328
|
+
|
329
|
+
"access": "阿蘇くまもと空港より車で約50分 ※ナビはGoogleマップをご利用ください。",
|
330
|
+
|
331
|
+
"parkingInformation": "有り 8台 無料 予約不要",
|
332
|
+
|
333
|
+
"nearestStation": "立野(熊本)",
|
334
|
+
|
335
|
+
"hotelImageUrl": "https://img.travel.rakuten.co.jp/share/HOTEL/68236/68236.jpg",
|
336
|
+
|
337
|
+
"hotelThumbnailUrl": "https://img.travel.rakuten.co.jp/HIMG/90/68236.jpg",
|
338
|
+
|
339
|
+
"roomImageUrl": "https://img.travel.rakuten.co.jp/share/HOTEL/68236/68236_h.jpg",
|
340
|
+
|
341
|
+
"roomThumbnailUrl": "https://img.travel.rakuten.co.jp/HIMG/INTERIOR/68236.jpg",
|
342
|
+
|
343
|
+
"hotelMapImageUrl": "https://img.travel.rakuten.co.jp/share/HOTEL/68236/68236map.gif",
|
344
|
+
|
345
|
+
"reviewCount": 229,
|
346
|
+
|
347
|
+
"reviewAverage": 4.57,
|
348
|
+
|
349
|
+
"userReview": null
|
350
|
+
|
351
|
+
}
|
352
|
+
|
353
|
+
},
|
354
|
+
|
355
|
+
{
|
356
|
+
|
357
|
+
"hotelRatingInfo": {
|
358
|
+
|
359
|
+
"serviceAverage": 0,
|
360
|
+
|
361
|
+
"locationAverage": 0,
|
362
|
+
|
363
|
+
"roomAverage": 0,
|
364
|
+
|
365
|
+
"equipmentAverage": 0,
|
366
|
+
|
367
|
+
"bathAverage": 0,
|
368
|
+
|
369
|
+
"mealAverage": 0
|
370
|
+
|
371
|
+
}
|
372
|
+
|
373
|
+
}
|
374
|
+
|
375
|
+
]
|
376
|
+
|
377
|
+
}
|
378
|
+
|
379
|
+
]
|
60
380
|
|
61
381
|
}
|
62
382
|
|
63
|
-
|
64
|
-
|
65
|
-
struct Hotel: Codable {
|
66
|
-
|
67
|
-
let hotel: [HotelInfo]
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
struct HotelInfo: Codable {
|
72
|
-
|
73
|
-
let info: HotelValue
|
74
|
-
|
75
|
-
private enum CodingKeys: String, CodingKey {
|
76
|
-
|
77
|
-
case info = "hotelBasicInfo"
|
78
|
-
|
79
|
-
}
|
80
|
-
|
81
|
-
}
|
82
|
-
|
83
|
-
}
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
struct HotelValue: Codable {
|
88
|
-
|
89
|
-
let name: String
|
90
|
-
|
91
|
-
let infoURL: String
|
92
|
-
|
93
|
-
let description: String
|
94
|
-
|
95
|
-
let hotelImageURL: String
|
96
|
-
|
97
|
-
let roomImageURL: String
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
private enum CodingKeys: String, CodingKey {
|
102
|
-
|
103
|
-
case name = "hotelName"
|
104
|
-
|
105
|
-
case infoURL = "hotelInformationUrl"
|
106
|
-
|
107
|
-
case description = "hotelSpecial"
|
108
|
-
|
109
|
-
case hotelImageURL = "hotelImageUrl"
|
110
|
-
|
111
|
-
case roomImageURL = "roomImageUrl"
|
112
|
-
|
113
|
-
}
|
114
|
-
|
115
|
-
}
|
116
|
-
|
117
383
|
```
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
レスポンスのjson
|
122
|
-
|
123
|
-
```
|
124
|
-
|
125
|
-
{
|
126
|
-
|
127
|
-
"pagingInfo": {
|
128
|
-
|
129
|
-
"recordCount": 2309,
|
130
|
-
|
131
|
-
"pageCount": 77,
|
132
|
-
|
133
|
-
"page": 1,
|
134
|
-
|
135
|
-
"first": 1,
|
136
|
-
|
137
|
-
"last": 30
|
138
|
-
|
139
|
-
},
|
140
|
-
|
141
|
-
"hotels": [
|
142
|
-
|
143
|
-
{
|
144
|
-
|
145
|
-
"hotel": [
|
146
|
-
|
147
|
-
{
|
148
|
-
|
149
|
-
"hotelBasicInfo": {
|
150
|
-
|
151
|
-
"hotelNo": 1019,
|
152
|
-
|
153
|
-
"hotelName": "森のスパリゾート 北海道ホテル",
|
154
|
-
|
155
|
-
"hotelInformationUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/JBe8h/?f_no=1019",
|
156
|
-
|
157
|
-
"planListUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/3VTwt/?f_no=1019&f_flg=PLAN",
|
158
|
-
|
159
|
-
"dpPlanListUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/IWrzP/?noTomariHotel=1019",
|
160
|
-
|
161
|
-
"reviewUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/HTX0u/?f_hotel_no=1019",
|
162
|
-
|
163
|
-
"hotelKanaName": "もりのすぱりじーと ほっかいどう",
|
164
|
-
|
165
|
-
"hotelSpecial": "モール温泉浴場を備えた緑に囲まれたシティホテル。全室Wi-fi接続&LANケーブル接続可能",
|
166
|
-
|
167
|
-
"hotelMinCharge": 3780,
|
168
|
-
|
169
|
-
"latitude": 154468.78,
|
170
|
-
|
171
|
-
"longitude": 515524.06,
|
172
|
-
|
173
|
-
"postalCode": "080-0017",
|
174
|
-
|
175
|
-
"address1": "北海道",
|
176
|
-
|
177
|
-
"address2": "帯広市西7条南19丁目1",
|
178
|
-
|
179
|
-
"telephoneNo": "0155-21-0001",
|
180
|
-
|
181
|
-
"faxNo": "0155-25-3721",
|
182
|
-
|
183
|
-
"access": "根室本線JR帯広駅南口から車で5分。帯広空港より車で30分。",
|
184
|
-
|
185
|
-
"parkingInformation": "有り 180台 無料",
|
186
|
-
|
187
|
-
"nearestStation": "帯広",
|
188
|
-
|
189
|
-
"hotelImageUrl": "https://img.travel.rakuten.co.jp/share/HOTEL/1019/1019.jpg",
|
190
|
-
|
191
|
-
"hotelThumbnailUrl": "https://img.travel.rakuten.co.jp/HIMG/90/1019.jpg",
|
192
|
-
|
193
|
-
"roomImageUrl": "https://img.travel.rakuten.co.jp/share/HOTEL/1019/1019_tw1.jpg",
|
194
|
-
|
195
|
-
"roomThumbnailUrl": "https://img.travel.rakuten.co.jp/HIMG/INTERIOR/1019.jpg",
|
196
|
-
|
197
|
-
"hotelMapImageUrl": "https://img.travel.rakuten.co.jp/share/HOTEL/1019/1019map.gif",
|
198
|
-
|
199
|
-
"reviewCount": 1876,
|
200
|
-
|
201
|
-
"reviewAverage": 4.43,
|
202
|
-
|
203
|
-
"userReview": "今回が2回目の宿泊ですが、今回は家族での利用のため、前回よりも広いテラス付きのツインにしました。朝にテラスから庭にいるリスが見れて家族もテンションが上がっていました。朝食も大変美味しく、大浴場も街中の… 2021-10-02 19:54:40投稿 <a href="https://img.travel.rakuten.co.jp/image/tr/api/kw/HTX0u/?f_hotel_no=1019" class="3click">つづきはこちら</a>"
|
204
|
-
|
205
|
-
}
|
206
|
-
|
207
|
-
},
|
208
|
-
|
209
|
-
{
|
210
|
-
|
211
|
-
"hotelRatingInfo": {
|
212
|
-
|
213
|
-
"serviceAverage": 4.27,
|
214
|
-
|
215
|
-
"locationAverage": 4.29,
|
216
|
-
|
217
|
-
"roomAverage": 4.39,
|
218
|
-
|
219
|
-
"equipmentAverage": 4.32,
|
220
|
-
|
221
|
-
"bathAverage": 4.26,
|
222
|
-
|
223
|
-
"mealAverage": 4.42
|
224
|
-
|
225
|
-
}
|
226
|
-
|
227
|
-
}
|
228
|
-
|
229
|
-
]
|
230
|
-
|
231
|
-
},
|
232
|
-
|
233
|
-
{
|
234
|
-
|
235
|
-
"hotel": [
|
236
|
-
|
237
|
-
{
|
238
|
-
|
239
|
-
"hotelBasicInfo": {
|
240
|
-
|
241
|
-
"hotelNo": 1968,
|
242
|
-
|
243
|
-
"hotelName": "北海道第一ホテルサッポロ",
|
244
|
-
|
245
|
-
"hotelInformationUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/JBe8h/?f_no=1968",
|
246
|
-
|
247
|
-
"planListUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/3VTwt/?f_no=1968&f_flg=PLAN",
|
248
|
-
|
249
|
-
"dpPlanListUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/IWrzP/?noTomariHotel=1968",
|
250
|
-
|
251
|
-
"reviewUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/HTX0u/?f_hotel_no=1968",
|
252
|
-
|
253
|
-
"hotelKanaName": "ほっかいどう だいいちほてる さっぽろ",
|
254
|
-
|
255
|
-
"hotelSpecial": "コンビニ隣、飲食店街すぐそば。地下鉄駅、空港連絡バス乗り場まで徒歩1分。",
|
256
|
-
|
257
|
-
"hotelMinCharge": 2250,
|
258
|
-
|
259
|
-
"latitude": 155113.74,
|
260
|
-
|
261
|
-
"longitude": 508850.83,
|
262
|
-
|
263
|
-
"postalCode": "001-0023",
|
264
|
-
|
265
|
-
"address1": "北海道",
|
266
|
-
|
267
|
-
"address2": "札幌市北区北23条西4丁目2-6",
|
268
|
-
|
269
|
-
"telephoneNo": "011-726-3232",
|
270
|
-
|
271
|
-
"faxNo": "011-726-9855",
|
272
|
-
|
273
|
-
"access": "JR札幌駅より地下鉄南北線麻生方面 「北24条駅」下車 → 4番出口徒歩1分。【高速】札樽道 → 北インターから約8分",
|
274
|
-
|
275
|
-
"parkingInformation": "徒歩2,3分の契約駐車場(高さ2.1mまで)1泊900円",
|
276
|
-
|
277
|
-
"nearestStation": "北24条",
|
278
|
-
|
279
|
-
"hotelImageUrl": "https://img.travel.rakuten.co.jp/share/HOTEL/1968/1968.jpg",
|
280
|
-
|
281
|
-
"hotelThumbnailUrl": "https://img.travel.rakuten.co.jp/HIMG/90/1968.jpg",
|
282
|
-
|
283
|
-
"roomImageUrl": "https://img.travel.rakuten.co.jp/share/HOTEL/1968/1968_sgl.jpg",
|
284
|
-
|
285
|
-
"roomThumbnailUrl": "https://img.travel.rakuten.co.jp/HIMG/INTERIOR/1968.jpg",
|
286
|
-
|
287
|
-
"hotelMapImageUrl": "https://img.travel.rakuten.co.jp/share/HOTEL/1968/1968map.gif",
|
288
|
-
|
289
|
-
"reviewCount": 1135,
|
290
|
-
|
291
|
-
"reviewAverage": 3.63,
|
292
|
-
|
293
|
-
"userReview": null
|
294
|
-
|
295
|
-
}
|
296
|
-
|
297
|
-
},
|
298
|
-
|
299
|
-
{
|
300
|
-
|
301
|
-
"hotelRatingInfo": {
|
302
|
-
|
303
|
-
"serviceAverage": 0,
|
304
|
-
|
305
|
-
"locationAverage": 0,
|
306
|
-
|
307
|
-
"roomAverage": 0,
|
308
|
-
|
309
|
-
"equipmentAverage": 0,
|
310
|
-
|
311
|
-
"bathAverage": 0,
|
312
|
-
|
313
|
-
"mealAverage": 0
|
314
|
-
|
315
|
-
}
|
316
|
-
|
317
|
-
}
|
318
|
-
|
319
|
-
]
|
320
|
-
|
321
|
-
},
|
322
|
-
|
323
|
-
{
|
324
|
-
|
325
|
-
"hotel": [
|
326
|
-
|
327
|
-
{
|
328
|
-
|
329
|
-
"hotelBasicInfo": {
|
330
|
-
|
331
|
-
"hotelNo": 68236,
|
332
|
-
|
333
|
-
"hotelName": "北海道の輝き☆ティンクナ",
|
334
|
-
|
335
|
-
"hotelInformationUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/JBe8h/?f_no=68236",
|
336
|
-
|
337
|
-
"planListUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/3VTwt/?f_no=68236&f_flg=PLAN",
|
338
|
-
|
339
|
-
"dpPlanListUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/IWrzP/?noTomariHotel=68236",
|
340
|
-
|
341
|
-
"reviewUrl": "https://img.travel.rakuten.co.jp/image/tr/api/kw/HTX0u/?f_hotel_no=68236",
|
342
|
-
|
343
|
-
"hotelKanaName": "ほっかいどうのかがやき☆てぃんくな",
|
344
|
-
|
345
|
-
"hotelSpecial": "阿蘇×北海道の創作フレンチが自慢。北海道から移住した夫婦が営む宿",
|
346
|
-
|
347
|
-
"hotelMinCharge": 5780,
|
348
|
-
|
349
|
-
"latitude": 118208.44,
|
350
|
-
|
351
|
-
"longitude": 471872.92,
|
352
|
-
|
353
|
-
"postalCode": "869-1504",
|
354
|
-
|
355
|
-
"address1": "熊本県",
|
356
|
-
|
357
|
-
"address2": "阿蘇郡南阿蘇村大字一関1471-2",
|
358
|
-
|
359
|
-
"telephoneNo": "0967-62-8044",
|
360
|
-
|
361
|
-
"faxNo": "0967-62-8166",
|
362
|
-
|
363
|
-
"access": "阿蘇くまもと空港より車で約50分 ※ナビはGoogleマップをご利用ください。",
|
364
|
-
|
365
|
-
"parkingInformation": "有り 8台 無料 予約不要",
|
366
|
-
|
367
|
-
"nearestStation": "立野(熊本)",
|
368
|
-
|
369
|
-
"hotelImageUrl": "https://img.travel.rakuten.co.jp/share/HOTEL/68236/68236.jpg",
|
370
|
-
|
371
|
-
"hotelThumbnailUrl": "https://img.travel.rakuten.co.jp/HIMG/90/68236.jpg",
|
372
|
-
|
373
|
-
"roomImageUrl": "https://img.travel.rakuten.co.jp/share/HOTEL/68236/68236_h.jpg",
|
374
|
-
|
375
|
-
"roomThumbnailUrl": "https://img.travel.rakuten.co.jp/HIMG/INTERIOR/68236.jpg",
|
376
|
-
|
377
|
-
"hotelMapImageUrl": "https://img.travel.rakuten.co.jp/share/HOTEL/68236/68236map.gif",
|
378
|
-
|
379
|
-
"reviewCount": 229,
|
380
|
-
|
381
|
-
"reviewAverage": 4.57,
|
382
|
-
|
383
|
-
"userReview": null
|
384
|
-
|
385
|
-
}
|
386
|
-
|
387
|
-
},
|
388
|
-
|
389
|
-
{
|
390
|
-
|
391
|
-
"hotelRatingInfo": {
|
392
|
-
|
393
|
-
"serviceAverage": 0,
|
394
|
-
|
395
|
-
"locationAverage": 0,
|
396
|
-
|
397
|
-
"roomAverage": 0,
|
398
|
-
|
399
|
-
"equipmentAverage": 0,
|
400
|
-
|
401
|
-
"bathAverage": 0,
|
402
|
-
|
403
|
-
"mealAverage": 0
|
404
|
-
|
405
|
-
}
|
406
|
-
|
407
|
-
}
|
408
|
-
|
409
|
-
]
|
410
|
-
|
411
|
-
}
|
412
|
-
|
413
|
-
]
|
414
|
-
|
415
|
-
}
|
416
|
-
|
417
|
-
```
|
2
見やすくした
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,7 +6,9 @@
|
|
6
6
|
|
7
7
|
エラーメッセージ
|
8
8
|
|
9
|
+
```
|
10
|
+
|
9
|
-
|
11
|
+
▿ DecodingError
|
10
12
|
|
11
13
|
▿ keyNotFound : 2 elements
|
12
14
|
|
@@ -38,7 +40,9 @@
|
|
38
40
|
|
39
41
|
- debugDescription : "No value associated with key CodingKeys(stringValue: \"hotelBasicInfo\", intValue: nil) (\"hotelBasicInfo\")."
|
40
42
|
|
41
|
-
- underlyingError : nil
|
43
|
+
- underlyingError : nil
|
44
|
+
|
45
|
+
```
|
42
46
|
|
43
47
|
|
44
48
|
|
1
誤字の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -46,9 +46,9 @@
|
|
46
46
|
|
47
47
|
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
swift側でのCodableの定義
|
50
|
+
|
51
|
+
```swift
|
52
52
|
|
53
53
|
struct Hotels: Codable {
|
54
54
|
|