Incomplete response getting parsed in swift iOS using codable

I am first time developing app for CarPlay iOS.
Where I am fetching list of stations to be played on CarPlay radio.

Following is the JSON response….

 {
  "stations": [
    {
      "id": "ce2a2901-dae3-48a1-a16c-5904287694d7",
      "market": "genre",
      "name": "Coles Radio",
      "tag": "colesradio",
      "description": "",
      "tagline": "",
      "isExclusive": false,
      "isDefault": true,
      "startDate": "2023-03-16T07:15:00.000Z",
      "endDate": "2099-12-31T00:00:00.000Z",
      "createdAt": "2023-03-16T17:15:00.000Z",
      "updatedAt": null,
      "links": null,
      "slugs": [
        "colesradio"
      ],
      "locations": null,
      "transmissions": [
        {
          "id": "7af53831-5730-441c-861d-aea3e6c25290",
          "type": "ip",
          "streams": [
            {
              "id": "4a380cf9-3b5a-4a1c-8dfe-f39377969c64",
              "type": "mp3",
              "mimeType": "audio/mpeg",
              "url": "https://playerservices.streamtheworld.com/api/livestream-redirect/COLES_CONSUMER.mp3",
              "tritonMount": "COLES_CONSUMER",
              "bitrate": 96,
              "stationId": "ce2a2901-dae3-48a1-a16c-5904287694d7"
            },
            {
              "id": "5c2693a9-8c99-4182-8991-422c7b8d5e26",
              "type": "aac",
              "mimeType": "audio/aac",
              "url": "https://playerservices.streamtheworld.com/api/livestream-redirect/COLES_CONSUMERAAC48.m3u8",
              "tritonMount": "COLES_CONSUMERAAC48",
              "bitrate": 48,
              "stationId": "ce2a2901-dae3-48a1-a16c-5904287694d7"
            }
          ]
        }
      ],
      "branding": {
        "primaryColour": "#EB1C24",
        "secondaryColour": "#EB1C24",
        "tertiaryColour": null
      },
      "brandTag": "partners",
      "assets": {
        "logos": {
          "app": {
            "landscape": [
              "https://hub-novaent-io-assets.s3.amazonaws.com/partners/colesradio/logos/app/landscape/[email protected]",
              "https://hub-novaent-io-assets.s3.amazonaws.com/partners/colesradio/logos/app/landscape/[email protected]",
              "https://hub-novaent-io-assets.s3.amazonaws.com/partners/colesradio/logos/app/landscape/[email protected]"
            ],
            "portrait": [
              "https://hub-novaent-io-assets.s3.amazonaws.com/partners/colesradio/logos/app/portrait/[email protected]",
              "https://hub-novaent-io-assets.s3.amazonaws.com/partners/colesradio/logos/app/portrait/[email protected]",
              "https://hub-novaent-io-assets.s3.amazonaws.com/partners/colesradio/logos/app/portrait/[email protected]"
            ]
          },
          "carPlay": [
            "https://hub-novaent-io-assets.s3.amazonaws.com/partners/colesradio/logos/carPlay/image.png"
          ],
          "chromeCast": [
            "https://hub-novaent-io-assets.s3.amazonaws.com/partners/colesradio/logos/chromeCast/image.png"
          ],
          "web": {
            "landscape": [
              "https://hub-novaent-io-assets.s3.amazonaws.com/partners/colesradio/logos/web/landscape/colour1.svg",
              "https://hub-novaent-io-assets.s3.amazonaws.com/partners/colesradio/logos/web/landscape/colour2.svg"
            ],
            "portrait": [
              "https://hub-novaent-io-assets.s3.amazonaws.com/partners/colesradio/logos/web/portrait/colour1.svg",
              "https://hub-novaent-io-assets.s3.amazonaws.com/partners/colesradio/logos/web/portrait/colour2.svg"
            ],
            "trimmed": {
              "landscape": [
                "https://hub-novaent-io-assets.s3.amazonaws.com/partners/colesradio/logos/web/trimmed/landscape/colour1.svg",
                "https://hub-novaent-io-assets.s3.amazonaws.com/partners/colesradio/logos/web/trimmed/landscape/colour2.svg"
              ],
              "portrait": [
                "https://hub-novaent-io-assets.s3.amazonaws.com/partners/colesradio/logos/web/trimmed/portrait/colour1.svg",
                "https://hub-novaent-io-assets.s3.amazonaws.com/partners/colesradio/logos/web/trimmed/portrait/colour2.svg"
              ]
            }
          }
        },
        "artworks": [
          "https://hub-novaent-io-assets.s3.amazonaws.com/partners/colesradio/artworks/[email protected]",
          "https://hub-novaent-io-assets.s3.amazonaws.com/partners/colesradio/artworks/[email protected]",
          "https://hub-novaent-io-assets.s3.amazonaws.com/partners/colesradio/artworks/[email protected]"
        ]
      }
    }
  ],
  "pagination": {
    "totalResults": 21,
    "fromResult": 21,
    "toResult": 21,
    "perPage": 1,
    "currentPage": 2,
    "lastPage": 2
  }
}

I am using Codable protocol to Parse the data.

Following is my protocol.

struct RadioStationResponseModel: Codable {
    let stations: [Station]?
    let pagination: Pagination
}

// MARK: - Pagination
struct Pagination: Codable {
    let totalResults, fromResult, toResult, perPage: Int?
    let currentPage, lastPage: Int?
}

// MARK: - Station
struct Station: Codable {
    let id: String?
    let market: Market?
    let name, tag, description, tagline: String?
    let isExclusive, isDefault: Bool?
    let startDate: String?
    let endDate: EndDate?
    let createdAt: String?
    let updatedAt: JSONNull?
    let links: Links?
    let slugs: [String]?
    let locations: [Location]?
    let transmissions: [Transmission]?
    let branding: Branding?
    let brandTag: String?
    let assets: Assets?
}

// MARK: - Assets
struct Assets: Codable {
    let logos: Logos?
    let artworks: [String]?
}

// MARK: - Logos
struct Logos: Codable {
    let app: App?
    let carPlay, chromeCast: [String]?
    let web: Web?
}

// MARK: - App
struct App: Codable {
    let landscape, portrait: [String]?
}

// MARK: - Web
struct Web: Codable {
    let padded: Padded?
    let trimmed: App?
    let landscape, portrait: [String]?
}

// MARK: - Padded
struct Padded: Codable {
    let landscape: [String]?
}

// MARK: - Branding
struct Branding: Codable {
    let primaryColour, secondaryColour: AryColour?
    let tertiaryColour: JSONNull?
}

enum AryColour: String, Codable {
    case cf202E = "#CF202E"
    case eb1C24 = "#EB1C24"
    case ee7723 = "#EE7723"
    case the000000 = "#000000"
    case the005094 = "#005094"
}

enum EndDate: String, Codable {
    case the20991231T000000000Z = "2099-12-31T00:00:00.000Z"
}

// MARK: - Links
struct Links: Codable {
    let facebookURL, instagramURL: String?

    enum CodingKeys: String, CodingKey {
        case facebookURL = "facebookUrl"
        case instagramURL = "instagramUrl"
    }
}

// MARK: - Location
struct Location: Codable {
    let city, state, postcode, timezone: String?
}

enum Market: String, Codable {
    case genre = "genre"
    case metro = "metro"
}

// MARK: - Transmission
struct Transmission: Codable {
    let id: String?
    let type: TransmissionType?
    let streams: [Stream]?
    let band: Band?
    let frequency: String?
}

enum Band: String, Codable {
    case am = "am"
    case dab = "dab"
    case fm = "fm"
}

// MARK: - Stream
struct Stream: Codable {
    let id: String?
    let type: StreamType?
    let mimeType: MIMEType?
    let url: String?
    let tritonMount: String?
    let bitrate: Int?
    let stationID: String?

    enum CodingKeys: String, CodingKey {
        case id, type, mimeType, url, tritonMount, bitrate
        case stationID = "stationId"
    }
}

enum MIMEType: String, Codable {
    case audioAAC = "audio/aac"
    case audioMPEG = "audio/mpeg"
}

enum StreamType: String, Codable {
    case aac = "aac"
    case mp3 = "mp3"
}

enum TransmissionType: String, Codable {
    case broadcast = "broadcast"
    case ip = "ip"
}

// MARK: - Encode/decode helpers

class JSONNull: Codable, Hashable {

    public static func == (lhs: JSONNull, rhs: JSONNull) -> Bool {
            return true
    }

    public var hashValue: Int {
            return 0
    }

    public init() {}

    public required init(from decoder: Decoder) throws {
            let container = try decoder.singleValueContainer()
            if !container.decodeNil() {
                    throw DecodingError.typeMismatch(JSONNull.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "Wrong type for JSONNull"))
            }
    }

    public func encode(to encoder: Encoder) throws {
            var container = encoder.singleValueContainer()
            try container.encodeNil()
    }
}

This is the way I am calling my API and handling response.

let netwokService : NetworkService = DefaultNetworkService()
    let request = RadioModel()
    netwokService.request(request, completion: { [weak self] result in
      switch result{
      case .success(let radioStationResponse):
        print("Radio station : (radioStationResponse)")
      case .failure(let errorValue):
        print("Erro : (errorValue)")
      }
      
    })



func decode(_ data: Data) throws -> RadioStationResponseModel {
    let decoder = JSONDecoder()
    let response = try decoder.decode(RadioStationResponseModel.self, from: data)
    print("Response received :- (response)")
    return response
  }

But the problem here I am facing is, I am not getting second object from response.

I am able to get only first object. Pagination object I am getting as nil, but is has value in it which I need for my further work.

Can anyone please help me to understand what’s wrong I am doing.

Thank you for help in advance.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật