I'm trying to initialize a struct so I can parse from a JSON file in Swift. I have the following written:
struct StopDescription: Decodable {
let stopId: String
let translocStopId: String
let stopName: String
let stopDesc: String
let stopLat: String
let stopLon: String
let directionId: String
let times: [String]
}
In order to parse from this JSON code:
{
stop_id: "M1",
transloc_stop_id: "4160714",
stop_name: "blank",
stop_desc: "blank",
stop_lat: "142",
stop_lon: "-171",
direction_id: "1",
times: [
"7:00 AM",
"7:30 AM",
"8:00 AM",
"8:30 AM",
"8:45 AM",
"9:00 AM",
"9:30 AM",
"10:00 AM",
"10:30 AM",
"11:00 AM",
"11:30 AM"
]
}
I'm not entirely sure if my Array declaration for the times variable is correct. Could someone please point me in the right direction?