Json error handling if object does not exist


    for each video in json["schedule"][0]["items"]
        video_title = video["container"]["title"]

Sometimes [“container”][“title”] does not exit in some of the returned json files, how would I go about skipping the error and just saying that video_title = “No Title Available”?

Just do a quick check to see if video[“container”][“title”] is invalid.

Something like this I would think.


if video["container"] = invalid or video["container"]["title"] = invalid
    video_title = "No Title Available"
else
    video_title = video["container"]["title"]
end if

Works perfect, but I swear I tried this several times before and kept getting errors lol. I could just be going crazy. Thanks for the help