此代碼:轉換字典成一個陣列
for (NSDictionary *object in JSONArray) {
NSMutableArray *birdtemp = [[NSMutableArray alloc] initWithObjects:object[@"case_name"], nil];
[allparts addObject:birdtemp];
}
輸出此日誌:
log: (
(
"NZXT Phantom 410"
),
(
"Thermaltake MK+"
)
)
我想知道我可以使用什麼樣的代碼,以使該登錄到一個數組,如:
log: (
"NZXT Phantom 410",
"Thermaltake MK+"
)
Json陣列是:
log: (
{
"case_color" = White;
"case_description" = "";
"case_image" = "http://sitecom/get/parts/part_images/nzxtphantom410.jpeg";
"case_name" = "NZXT Phantom 410";
"case_price" = "99.99";
"case_type" = ATX;
id = 1;
},
{
"case_color" = Black;
"case_description" = "";
"case_image" = "http://site.com/get/parts/part_images/thernaltake-mkplus.jpeg";
"case_name" = "Thermaltake MK+";
"case_price" = "84.99";
"case_type" = ATX;
id = 2;
}
)
什麼是JSONArray可以如何打印它的未來 – sachin 2012-08-17 07:23:46
[array addObject:dictionaryObject]; – Tendulkar 2012-08-17 07:24:04