Ich bekomme von einem REST Call Daten zurück die ich mit
in ein JSON Objekt umwandeln lasse. Wenn ich mir das Objekt nun mit print anzeigen lasse bekomme ich das hier:
Ich weiß jetzt nicht wie ich an die Daten in dem Object ran kommen. ich möchte die gerne in einer Tableview darstellen lassen. Ich habe schon versucht im Debugger (wenn ein Haltepunkt gesetzt ist) mit "po" herauszufinden was geht, aber mehr als "po jason["ConfigItem"] bekomme ich nicht raus. In diesem "ConfigItem" steckt aber noch mehr drin, wie man sehen kann.
Kann mir vielleicht jemand weiter helfen?
Danke im voraus.
Dirk
if let json = try JSONSerialization.jsonObject(with: data!, options: .allowFragments) as? [String: Any]
in ein JSON Objekt umwandeln lasse. Wenn ich mir das Objekt nun mit print anzeigen lasse bekomme ich das hier:
["ConfigItem": <__NSSingleObjectArrayI 0x6000000060f0>(
{
CIXMLData = {
AllIPAddresses = "192.168.0.60";
AssignedCompany = 13003;
CPU = "Intel(R) Xeon(R) CPU 3060 @ 2.40GHz(2400 MHz)";
FQDN = WORKGROUP;
HardDisk = (
{
Capacity = "238.44 GB ";
HardDisk = "HP LOGICAL VOLUME SCSI Disk Device (238.4 GB) ";
},
{
Capacity = " 11177.91 GB ";
HardDisk = " HP LOGICAL VOLUME SCSI Disk Device (11177.9 GB) ";
},
{
Capacity = " 1863.01 GB";
HardDisk = " WDC WD20 EARX-00PASB0 USB Device (1863 GB)";
},
"",
""
);
IPAddress = "192.168.0.60";
Model = "ProLiant DL320s G1";
NIC = (
{
IPoverDHCP = Yes;
MACAdress = "00:1E:0B:F9:93:DC";
NIC = "[00000007] Broadcom NetXtreme-Gigabit-Ethernet ";
},
{
IPoverDHCP = No;
NIC = " [00000010] Broadcom NetXtreme-Gigabit-Ethernet";
},
"",
"",
""
);
NumberOfCPUCores = 2;
NumberOfPhysicalCPU = 1;
OperatingSystem = "Microsoft Windows Server 2008 R2 Standard";
Ram = 8190;
SerialNumber = BG874064GB;
Type = Server;
Vendor = HP;
};
Class = Computer;
ConfigItemID = 16;
CreateBy = 3;
CreateTime = "2017-02-08 10:08:42";
CurDeplState = Production;
CurDeplStateType = productive;
CurInciState = Operational;
CurInciStateType = operational;
DefinitionID = 41;
DeplState = Production;
DeplStateType = productive;
InciState = Operational;
InciStateType = operational;
LastVersionID = 24;
Name = "HPS";
Number = 0022000077;
VersionID = 24;
}
)
]
1
("ConfigItem", <__NSSingleObjectArrayI 0x6000000060f0>(
{
CIXMLData = {
AllIPAddresses = "192.168.0.60";
AssignedCompany = 13003;
CPU = "Intel(R) Xeon(R) CPU 3060 @ 2.40GHz(2400 MHz)";
FQDN = WORKGROUP;
HardDisk = (
{
Capacity = "238.44 GB ";
HardDisk = "HP LOGICAL VOLUME SCSI Disk Device (238.4 GB) ";
},
{
Capacity = " 11177.91 GB ";
HardDisk = " HP LOGICAL VOLUME SCSI Disk Device (11177.9 GB) ";
},
{
Capacity = " 1863.01 GB";
HardDisk = " WDC WD20 EARX-00PASB0 USB Device (1863 GB)";
},
"",
""
);
IPAddress = "192.168.0.60";
Model = "ProLiant DL320s G1";
NIC = (
{
IPoverDHCP = Yes;
MACAdress = "00:1E:0B:F9:93:DC";
NIC = "[00000007] Broadcom NetXtreme-Gigabit-Ethernet ";
},
{
IPoverDHCP = No;
NIC = " [00000010] Broadcom NetXtreme-Gigabit-Ethernet";
},
"",
"",
""
);
NumberOfCPUCores = 2;
NumberOfPhysicalCPU = 1;
OperatingSystem = "Microsoft Windows Server 2008 R2 Standard";
Ram = 8190;
SerialNumber = BG874064GB;
Type = Server;
Vendor = HP;
};
Class = Computer;
ConfigItemID = 16;
CreateBy = 3;
CreateTime = "2017-02-08 10:08:42";
CurDeplState = Production;
CurDeplStateType = productive;
CurInciState = Operational;
CurInciStateType = operational;
DefinitionID = 41;
DeplState = Production;
DeplStateType = productive;
InciState = Operational;
InciStateType = operational;
LastVersionID = 24;
Name = "HPS";
Number = 0022000077;
VersionID = 24;
}
)
)
Ich weiß jetzt nicht wie ich an die Daten in dem Object ran kommen. ich möchte die gerne in einer Tableview darstellen lassen. Ich habe schon versucht im Debugger (wenn ein Haltepunkt gesetzt ist) mit "po" herauszufinden was geht, aber mehr als "po jason["ConfigItem"] bekomme ich nicht raus. In diesem "ConfigItem" steckt aber noch mehr drin, wie man sehen kann.
Kann mir vielleicht jemand weiter helfen?
Danke im voraus.
Dirk