zoukankan      html  css  js  c++  java
  • iOS SDK原生JSON解析

    - (IBAction)touchReadButton:(id)sender 
    {          
            NSData *jsonData = [[NSData alloc]    initWithContentsOfFile:JSON_PATH];    
            NSError *error = nil;    
            id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingAllowFragments error:&error;];         
            if (jsonObject != nil && error == nil)
              {        
                   NSLog(@"Successfully deserialized...");        
                   if ([jsonObject isKindOfClass:[NSDictionary class]])
                    {             
                        NSDictionary *deserializedDictionary = (NSDictionary *)    jsonObject;           
                      NSLog(@"Dersialized JSON Dictionary = %@", deserializedDictionary);         
                    }
                 else if([jsonObject isKindOfClass:[NSArray class]])
                {             
                    NSArray *deserializedArray = (NSArray *)jsonObject;                     
                    NSLog(@"Dersialized JSON Array = %@", deserializedArray);         
                }
          
    else {
               NSLog(
    @"An error happened while deserializing the JSON data.");
    } } }
  • 相关阅读:
    Redis 连接命令
    Redis 脚本
    Redis 事务
    Redis 发布订阅
    Redis HyperLogLog
    Redis 有序集合(sorted set)
    Redis 集合(Set)
    Redis 列表(List)
    Redis 哈希(Hash)
    特定消费者的限制流量
  • 原文地址:https://www.cnblogs.com/joesen/p/3476779.html
Copyright © 2011-2022 走看看