title: Replacing nulls with empty string from JSON response not working in iOS
body: <p>I used below code to replace nulls from json response with empty string, but it is not working. Please help me out to fix this issue, i am getting nulls from server response in lot of scenarios and App crashes.</p>
  
  <p>Code:</p>
  
  <pre><code>- (NSMutableDictionary *)recursive:(NSMutableDictionary *)dictionaryResponse {
  
      NSMutableDictionary *dictionary=[[NSMutableDictionary alloc]initWithDictionary:dictionaryResponse];
      for (NSString *key in [dictionary allKeys]) {
          id nullString = [dictionary objectForKey:key];
          if ([nullString isKindOfClass:[NSDictionary class]]) {
              [self recursive:(NSMutableDictionary*)nullString];
          }else if([nullString isKindOfClass:[NSArray class]]){
              for (int i=0; i&lt;[nullString count]; i++) {
                  id nullstr = [nullString objectAtIndex:i];
  
                  if ([nullstr isKindOfClass:[NSDictionary class]]) {
                      [self recursive:(NSMutableDictionary*)nullstr];
  
                  }
  
              }
          }else {
              if ((NSString*)nullString == (id)[NSNull null])
                  [dictionary setValue:@"" forKey:key];
          }
      }
      return dictionary;
  }
  </code></pre>