Можно попробовать
struct Root: Codable {
let quizzes: [Quiz]
let pageno: Int
let nextURL: String
enum CodingKeys: String, CodingKey {
case quizzes, pageno
case nextURL = "nextUrl"
}
}
struct Quiz: Codable {
let id: Int
let question: String
let author: Author?
let attachment: Attachment
let favourite: Bool
let tips: [String]
}
struct Attachment: Codable {
let filename: String
let mime: MIME
let url: String
}
enum MIME: String, Codable {
case imageJPEG = "image/jpeg"
}
struct Author: Codable {
let id: Int
let isAdmin: Bool?
let username: String
}
let roo = try? JSONDecoder().decode(Root.self,from:jsonData)
print(roo)