Youtube-onedayapp - unable to decode "videoID'

I am enjoying the series to create the Youtube-onedayapp, however I got stuck in the JSON decoding part.
Especially on the videoID.
All happening on this line: self.videoID = try resourceIdContainer.decode(String. self , forKey: .videoID)
When I catch the error it shows:
keyNotFound(CodingKeys(stringValue: “videoID”, intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: “items”, intValue: nil), _JSONKey(stringValue: “Index 0”, intValue: 0)], debugDescription: “No value associated with key CodingKeys(stringValue: “videoID”, intValue: nil) (“videoID”).”, underlyingError: nil))

I even tried to get another parameter ‘kind’ which is in the same JSON value pair, and that works smoothly, only the videoID part remains an issue…

The JSON API interface analysis does show a value for the parameter videoID.

I did a side-by side code comparison and found nothing weird…

Any suggestions?

Many thanks,

Carl

Carl,

Rather than .videoID try .videoId

The JSON will want an exact match.

Blessings,
—Mark

Many thanks Mark!
Solved and ready to finish the app…

Carl

1 Like