我无法从以下JSON获取方向值:
"routeOptions": [
{
"name": "Jubilee",
"directions": [
"Wembley Park Underground Station",
"Stanmore Underground Station"
],
"lineIdentifier": {
"id": "jubilee",
"name": "Jubilee",
"uri": "/Line/jubilee",
"type": "Line",
"routeType": "Unknown",
"status": "Unknown"
}
}
]
我相信路线是一个JSON数组,此刻我正在使用如下Codable。我已经设法获得routeOptions名称,但由于没有特定的键变量,因此似乎无法弄清楚如何获得路线指示。请有人帮忙吗?
struct RouteOptions: Codable {
let name: String?
let directions: [Directions]?
init(name: String, directions: [Directions]) {
self.name = name
self.directions = directions
}}
struct Directions: Codable {}