【发布时间】:2014-04-30 07:52:02
【问题描述】:
我已经使用以下代码解析了 Json
- (void) getWorkingCalendar:(NSData *)dataForParse{
NSMutableArray *locations = [[NSMutableArray alloc] init];
NSString* myString;
myString = [[NSString alloc] initWithData:dataForParse encoding:NSASCIIStringEncoding];
NSLog(@"data is %@", myString);
NSArray * parsedData = [NSJSONSerialization JSONObjectWithData:dataForParse options:kNilOptions error:nil];
NSLog(@"parser data %@", parsedData);
for (NSDictionary *dict in parsedData) {
NSLog(@"Value is %@", dict);
}
[delegate array:locations];
}
输出如下
2014-04-30 12:44:41.828 Testing[827:60b] parser data (
"/Date(1399016682788+0400)/",
"/Date(1399621482788+0400)/",
"/Date(1400226282788+0400)/",
"/Date(1400831082788+0400)/",
"/Date(1401435882788+0400)/"
)
2014-04-30 12:44:41.829 Testing[827:60b] Value is /Date(1399016682788+0400)/
2014-04-30 12:44:41.829 Testing[827:60b] Value is /Date(1399621482788+0400)/
2014-04-30 12:44:41.829 Testing[827:60b] Value is /Date(1400226282788+0400)/
2014-04-30 12:44:41.830 Testing[827:60b] Value is /Date(1400831082788+0400)/
2014-04-30 12:44:41.830 Testing[827:60b] Value is /Date(1401435882788+0400)/
2014-04-30 12:44:41.830 Testing[827:60b] finishDownloading
如何从 NSDictionary 获取 NSString 中的时隙?
提前致谢。
【问题讨论】:
-
哇...“
14014353123412341234431+0800”是什么日期? -
currentmillis.com打开这个链接,你就会知道@MichaelDautermann
-
您的服务返回的日期格式错误。服务端直接发送日期对象而不将其转换为日期字符串。
-
这些是毫秒,但我不知道如何在 IOS 中对其进行编码?
-
我想我需要将此毫秒值转换为日期,但我不知道该怎么做:(
标签: ios objective-c json