{
"message": {
"affenpinscher": [],
"african": [],
"airedale": [],
"akita": [],
"appenzeller": [],
"basenji": [],
"beagle": [],
"bluetick": [],
"borzoi": [],
"bouvier": [],
"boxer": [],
"brabancon": [],
"briard": [],
"buhund": [
"norwegian"
],
"bulldog": [
"boston",
"english",
"french"
],
"bullterrier": [
"staffordshire"
],
"cairn": [],
"cattledog": [
"australian"
],
"chihuahua": [],
"chow": [],
"clumber": [],
"cockapoo": [],
"collie": [
"border"
],
"coonhound": [],
"corgi": [
"cardigan"
],
"cotondetulear": [],
"dachshund": [],
"dalmatian": [],
"dane": [
"great"
],
"deerhound": [
"scottish"
],
"dhole": [],
"dingo": [],
"doberman": [],
"elkhound": [
"norwegian"
],
"entlebucher": [],
"eskimo": [],
"frise": [
"bichon"
],
"germanshepherd": [],
"greyhound": [
"italian"
],
"groenendael": [],
"hound": [
"afghan",
"basset",
"blood",
"english",
"ibizan",
"walker"
],
"husky": [],
"keeshond": [],
"kelpie": [],
"komondor": [],
"kuvasz": [],
"labrador": [],
"leonberg": [],
"lhasa": [],
"malamute": [],
"malinois": [],
"maltese": [],
"mastiff": [
"bull",
"english",
"tibetan"
],
"mexicanhairless": [],
"mix": [],
"mountain": [
"bernese",
"swiss"
],
"newfoundland": [],
"otterhound": [],
"papillon": [],
"pekinese": [],
"pembroke": [],
"pinscher": [
"miniature"
],
"pitbull": [],
"pointer": [
"german",
"germanlonghair"
],
"pomeranian": [],
"poodle": [
"miniature",
"standard",
"toy"
],
"pug": [],
"puggle": [],
"pyrenees": [],
"redbone": [],
"retriever": [
"chesapeake",
"curly",
"flatcoated",
"golden"
],
"ridgeback": [
"rhodesian"
],
"rottweiler": [],
"saluki": [],
"samoyed": [],
"schipperke": [],
"schnauzer": [
"giant",
"miniature"
],
"setter": [
"english",
"gordon",
"irish"
],
"sheepdog": [
"english",
"shetland"
],
"shiba": [],
"shihtzu": [],
"spaniel": [
"blenheim",
"brittany",
"cocker",
"irish",
"japanese",
"sussex",
"welsh"
],
"springer": [
"english"
],
"stbernard": [],
"terrier": [
"american",
"australian",
"bedlington",
"border",
"dandie",
"fox",
"irish",
"kerryblue",
"lakeland",
"norfolk",
"norwich",
"patterdale",
"russell",
"scottish",
"sealyham",
"silky",
"tibetan",
"toy",
"westhighland",
"wheaten",
"yorkshire"
],
"vizsla": [],
"waterdog": [
"spanish"
],
"weimaraner": [],
"whippet": [],
"wolfhound": [
"irish"
]
},
"status": "success"
}
Добавить комментарий
|
3 ответа
struct JsonStruct: Codable {
let message: [String: [String]]
let status: String
}
Как пример .
struct Article
{
var author: String
var title: String
var description: String
var url: String
var urlToImage: String
var publishedAt: String
var sourceName: String
init(dictionary: Dictionary<String, Any>)
{
author = dictionary["author"] as? String ?? ""
title = dictionary["title"] as? String ?? ""
description = dictionary["description"] as? String ?? ""
url = dictionary["url"] as? String ?? ""
urlToImage = dictionary["urlToImage"] as? String ?? ""
publishedAt = dictionary["publishedAt"] as? String ?? ""
sourceName = (dictionary["source"] as? Dictionary<String, Any> ?? ["":""]) ["name"] as? String ?? ""
}
}
struct Dogs: Codable {
let message: Text
let status: String
}
struct Text: Codable {
let text: [String]
}
У Вас почему-то message имеет структуру {...}, а не [...], поэтому вместо let text придется поставить конкретные значения let affenpinscher: [String], let african: [String] и т.д.