Ios 如何在Swift中找到解码JSON的第一个值

Ios 如何在Swift中找到解码JSON的第一个值,ios,json,swift,decodable,Ios,Json,Swift,Decodable,我试图在Swift中解码JSON树,以下文本是JSON树的样子: { "_type" = News; queryContext = { originalQuery = ""; }; readLink = "https://api.cognitive.microsoft.com/api/v7/news/search?q="; value = ( { ampUrl = "h

我试图在Swift中解码JSON树,以下文本是JSON树的样子:

{
    "_type" = News;
    queryContext =     {
        originalQuery = "";
    };
    readLink = "https://api.cognitive.microsoft.com/api/v7/news/search?q=";
    value =     (
                {
            ampUrl = "https://www.msn.com/en-us/news/us/its-no-different-from-new-york-urban-centers-nationwide-gird-for-catastrophic-virus-outbreak/amp/ar-BB11QzZ6?li=BBnb7Kz";
            category = Health;
            datePublished = "2020-03-28T18:36:05.0000000Z";
            description = "In Chicago, the Army Corps of Engineers was preparing to erect 2,500 patient quarters throughout three of the cavernous halls at McCormick Place, the largest convention center in North America. In Detroit, a major hospital system was readying a letter for patients and their families outlining how scarce ventilators would be allocated, saying ...";
            headline = 1;
            image =             {
                thumbnail =                 {
                    contentUrl = "https://www.bing.com/th?id=ON.0EDDB46C77D1689214EC5B7940C23A91&pid=News";
                    height = 367;
                    width = 700;
                };
            };
            name = "\U2018It\U2019s no different from New York\U2019: Urban centers nationwide gird for catastrophic virus outbreak";
            provider =             (
                                {
                    "_type" = Organization;
                    image =                     {
                        thumbnail =                         {
                            contentUrl = "https://www.bing.com/th?id=AR_04bc0c1c424cf64dec14a2982f0360ef&pid=news";
                        };
                    };
                    name = "The Washington Post on MSN.com";
                }
            );
我的数据解码结构如下所示:

struct Articles: Decodable {
    let values: [String: String]
    let name: String
}

我的终端告诉我“name”的值不存在。我的数据是否在“值”或其他项下

将您的
Struct
更改如下:

struct Articles: Decodable {
    let readLink: String
    let value: [Values]
}

struct Values: Decodable {
    let description: String
    let name: String
}
名称位于数组中


你想破译哪个名字?提供程序数组中还有一个。

它在值中,因此通过值访问它。名称。
名称
不在顶级。而
[String:Any]
的数组,因此是
[[String:Any]]
,而不是
[String:String]