//
//  NSString+AIJsonData.m
//  GMAILab
//
//  Created by 卢悦明 on 2020/5/9.
//

#import "NSString+AIJsonData.h"

@implementation NSString (AIJsonData)
/**
字符串转字典
 */
- (NSDictionary *)dictionaryWithJsonString {
    if (self == nil) {
        return nil;
    }
    NSData *jsonData = [self dataUsingEncoding:NSUTF8StringEncoding];
    NSError *err;
    NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData
                                                        options:NSJSONReadingMutableContainers
                                                          error:&err];
    if(err) {
        NSLog(@"json解析失败：%@",err);
        return nil;
    }
    return dic;
}
@end
