Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何解析JSON响应_Ios_Json - Fatal编程技术网

Ios 如何解析JSON响应

Ios 如何解析JSON响应,ios,json,Ios,Json,我想知道如何在iOS中解析JSON。请注意,我尝试使用: NSError* error; NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData //1 options:kNilOptions

我想知道如何在iOS中解析JSON。请注意,我尝试使用:

 NSError* error;
    NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData //1
                                                         options:kNilOptions 
                                                           error:&error];
但是,我给出了以下错误:

“操作无法完成。(可可错误3840)。”(字符310周围的对象格式错误。)UserInfo=0x135460{NSDebugDescription=字符310周围的对象格式错误。}

我试图解析的JSON响应是:

{“错误”:0,“标记”:“59188a107d705f8c51585d719769e0642ce98b79d86fdace30dbc58efba301cc”,“状态”:“200”,“消息”:[{“更新时间”:2012-03-09 12:25:26.0,“顺序”:“21”,“lng”:58.4236,“消息”:“我们标记的账单:测试”,“lat”:23.5871}”,“错误消息”:


这里没有字符310

无意冒犯,你确定这就是你要解析的字符串吗?另外,我会把那个日期加上引号,看看会发生什么。最佳实践是将所有文字值都放在引号中。如果您无法控制JSON,则可以发送一封严厉的电子邮件。

字符310表示索引310处的字符

无论如何,你的问题就在这里
“更新时间”:2012-03-09 12:25:26.0
。您必须添加引号:
“更新时间”:“2012-03-09 12:25:26.0”