Swift中的嵌套JSON解析

时间:2018-11-05 10:59:31

标签: json swift parsing nested-loops

如果我想要所有循环中的所有数据,如何将其更改为快速结构形式?

手段 来自commonsOfList的我想要storididisActivekeynamestatusvalue就像我想要的所有数据循环

    Optional({ 
    storeName = DocStore;
    commonsOfList =     (
                {
            storeId = 0;
            id = 1;
            isActive = 0;
            keyname = Contacts;
            status = 0;
            value = store;
        },
                {
            storeId = 0;
            id = 2;
            .
        .
    .   },
    .
    .   
    .

    );
 currentDate = "2018/11/05";
    grandTotals =     (
                {
            storeId = 0;
            commonId = 0;
            consentId = 0;
            Id = 0;
            grandTotal = 300;
             },
                {
            storeId = 0;
            commonId = 0;
            consentId = 0;
            Id = 0;
            grandTotal = 5500;
            }
    .   
    .
    {
    .   
    .
 }
    );
staffList=     (
                {
            accountExist = 0;
            adharId = 123456789012;
            admnId = 0;
            advanceAmount = 0;
            age = 18;
            storeId = 0;
    mob.No = 9876543200
        }
    .
    .
        {

    .
});
 procedureCommonId =     (
                {
            storeId = 0;
            commonId = 1;
            consentId = 0;
            Id = 0;
            paymentid = 0;
            InvoiceStatus = 0;
            proPlannDate = "25/10/2018";
            Status = 0;
            taxId = 0;
            totalCost = 0;
            totalDisCost = 0;
            PlanId = 0;
        },
             {
    .
    .
});
 storeList = (
   {
    :
    :
    :
   });

**

   struct list: Decodable {

  let name: String
  .
  .
  .

enum CodingKeys: String, CodingKey {

    case name = "name"
     .
     .
     .

}
}

**

如果您知道这一点,请回复 谢谢

由于JSON键和容器属性之间的映射以及解析语法紧密结合在一起,因此我们将同时检查两者的详细信息。

0 个答案:

没有答案