{
“error”: false,
“category”: “Misc”,
“type”: “single”,
“joke”: “My wife is really mad at the fact that I have no sense of direction.\nSo I packed up my stuff and right.”,
“flags”:
{
“nsfw”: false,
“religious”: false,
“political”: false,
“racist”: false,
“sexist”: false,
“explicit”: false
},
“id”: 201,
“safe”: true,
“lang”: “en”
}
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data, let joke = try? JSONDecoder().decode(Joke.self, from: data) {
print(joke.setup)
}
}
task.resume()
print(joke.setup)