我有以下JSON
{
CompanyName = "Len LTD";
Date = "3/31/2011";
DimensionsOfLoad = XX;
Duration = 2;
ID = 259;
JobNotes = "Dev Test";
JobStatusId = CLOSED;
JobType = "DUMP ";
Markers = (
{
Description = "";
Latitude = "43.593063354492188";
Longitude = "-79.643798828125";
},
{
Description = Clearbridge;
Latitude = "43.660285949707031";
Longitude = "-79.651351928710938";
}
);
MaterialMeasurement = KilogramsXCentimeters;
Payment = 100;
PaymentType = "Per Hour";
Summary = "Dev Test";
Time = "12:00AMX05:00AM";
TruckTypeID = FLATBED;
TrucksRequired = 1;
TypeOfMaterial = "";
WeightOfLoad = 0;
},
这只是JSON的一部分,这种格式重复多次
我之前在我的应用中解析了JSON,但问题是Markers = .. 问题是它有另一个级别,我似乎一直在拉这些数据值
SBJSON *parser = [[SBJSON alloc] init];
won_jobs = (NSMutableArray *)[parser objectWithString:string error:nil];
for (NSDictionary *won_job in won_jobs)
正确解析所有内容,我可以将objectForKey用于其他字段,并正确存储数据。
我尝试抓住标记并输入字典,但它给了我一些问题,一次尝试我刚刚给了我null。另一个不让我在新词典上使用objectForKey:
任何想法我能做什么?
答案 0 :(得分:1)
这是因为当您为所有密钥objectForKey:
执行Markers
时,您将获得NSString
,对于Markers
,您将获得NSArray
}。