- (NSArray *)checkNSArrayWithChangeUseful:(NSArray *)checkArray
{
if([checkArray isKindOfClass:[NSArray class]])
{
NSMutableArray *usefulArr = [NSMutableArray arrayWithArray:checkArray];
[usefulArr enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if([obj isKindOfClass:[NSNull class]] )
{
[usefulArr replaceObjectAtIndex:idx withObject:@""];
}else if([obj isKindOfClass:[NSNumber class]] || [obj isKindOfClass:[NSValue class]])
{
[usefulArr replaceObjectAtIndex:idx withObject:[NSString stringWithFormat:@"%@",obj]];
}else if([obj isKindOfClass:[NSDictionary class]])
{
[usefulArr replaceObjectAtIndex:idx withObject:[self checkNSDictinaryWithChangeUseful:obj]];
}else if([obj isKindOfClass:[NSArray class]])
{
[usefulArr replaceObjectAtIndex:idx withObject:[self checkNSArrayWithChangeUseful:obj]];
}
}];
return [NSArray arrayWithArray:usefulArr];
}
return checkArray;
}
- (NSDictionary *)checkNSDictinaryWithChangeUseful:(NSDictionary *)checkDictioary
{
if([checkDictioary isKindOfClass:[NSDictionary class]])
{
NSMutableDictionary *usefulDic = [NSMutableDictionary dictionaryWithDictionary:checkDictioary];
[usefulDic enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
if(ISNULL(obj) || ISNil(obj))
{
usefulDic[key] = @"";
}else if([obj isKindOfClass:[NSNumber class]] || [obj isKindOfClass:[NSValue class]])
{
usefulDic[key] = [NSString stringWithFormat:@"%@",obj];
}else if([obj isKindOfClass:[NSDictionary class]])
{
usefulDic[key] = [self checkNSDictinaryWithChangeUseful: obj];
}else if([obj isKindOfClass:[NSArray class]])
{
usefulDic[key] = [self checkNSArrayWithChangeUseful:obj];
}
}];
return [NSDictionary dictionaryWithDictionary:usefulDic];
}
return checkDictioary;
}