1.json字符串转字典或数组
方法:+ (id)JSONObjectWithData:(NSData)dataoptions:(NSJSONReadingOptions)opterror:(NSError _Nullable *)error
``` javascript
NSString *jsonStr;
NSData*jsonData = [jsonStrdataUsingEncoding:NSUTF8StringEncoding];
NSError*error;
NSDictionary*dic = [NSJSONSerialization JSONObjectWithData:jsonDataoptions:NSJSONReadingMutableContainers error:&error];
2.数组或者字典转换为json字符串
方法:+ (NSData)dataWithJSONObject:(id)objoptions:(NSJSONWritingOptions)opterror:(NSError _Nullable *)error
NSData *jsonData =[NSJSONSerialization dataWithJSONObject:dicoptions:(NSJSONWritingOptions)opterror:&error];