首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏宜达数字

    iOS开发--服务器返回的数据解析

    data JSONValue]; // JSON字符串也可以使用此方法 NSDictionary *dict1 = [@"{\"height\": 2}" JSONValue]; 第四种: 苹果自带:NSJSONSerialization (性能最好,iOS5.0出现) JSON数据(NSData) -> OC对象(Foundation Object) // 利用NSJSONSerialization类 + (id)JSONObjectWithData NSJSONReadingMutableLeaves NSJSONReadingAllowFragments */ // 解析JSON NSDictionary *dict = [NSJSONSerialization leichao/Desktop/video.plist" atomically:YES]; }]; } OC对象(Foundation Object)-> JSON数据(NSData) // 利用NSJSONSerialization NSJSONWritingOptions)opt error:(NSError **)error; // 将字典转成字符串 // NSJSONWritingPrettyPrinted : 好看的印刷 NSData *date = [NSJSONSerialization

    2.8K10发布于 2020-06-02
  • 来自专栏好派笔记

    IOS中get同步异步请求与post同步异步请求

    lld",response.expectedContentLength); NSLog(@"请求到的结果:%@",data); //6.解析文件 NSDictionary *dict = [NSJSONSerialization NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; //4.解析 NSDictionary *dict = [NSJSONSerialization data, NSError *connectionError) { //NSLog(@"%@",data); //4.解析 NSDictionary *dict = [NSJSONSerialization 接收完毕 (void)connectionDidFinishLoading:(NSURLConnection *)connection { //解析 NSDictionary *dict = [NSJSONSerialization

    3.7K20发布于 2021-10-29
  • 来自专栏王大锤

    iOS 自己封装的网络请求,json解析的类

    dispatch_async(dispatch_get_main_queue(), ^{ id jsonData = [NSJSONSerialization NSMutableURLRequest requestWithURL:url]; [request setHTTPMethod:@"POST"]; NSError* error; if ([NSJSONSerialization isValidJSONObject:params]) { NSData *jsonData = [NSJSONSerialization dataWithJSONObject:params %@",str); id jsonData = [NSJSONSerialization JSONObjectWithData:data options:0 error

    1.9K90发布于 2018-05-17
  • 来自专栏哈雷彗星撞地球

    iOS下WebRTC音视频通话(三)-音视频通话过程的分析补充

    data, NSURLResponse * _Nullable response, NSError * _Nullable error) { // NSDictionary *dict = [NSJSONSerialization @"offer"]) { NSDictionary *dict = @{@"roomId":self.roomId}; NSData *data = [NSJSONSerialization NSDictionary *jsonDict = @{ @"type" : sdp.type, @"sdp" : sdp.description }; NSData *jsonData = [NSJSONSerialization else if ([type isEqualToString:@"bye"]) { if (self.rtcView) { NSData *jsonData = [NSJSONSerialization ; NSData *data = [msg dataUsingEncoding:NSUTF8StringEncoding]; NSDictionary *sinalingMsg = [NSJSONSerialization

    5.6K60发布于 2018-08-22
  • 来自专栏正则

    AFNetworking源码探究(十一) —— 数据解析之子类中协议方法的实现

    isSpace) { responseObject = [NSJSONSerialization JSONObjectWithData:data options:self.readingOptions isSpace) { responseObject = [NSJSONSerialization JSONObjectWithData:data options:self.readingOptions isSpace) { responseObject = [NSJSONSerialization JSONObjectWithData:data options:self.readingOptions For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions". `0` 有关可能的值,请参阅“NSJSONSerialization”文档部分“NSJSONReadingOptions”。

    1.8K30发布于 2021-09-03
  • 来自专栏iOS逆向与安全

    iOS测试指南之 【保存接口返回枚举数据为本地json文件,作为测试数据】

    searchEnum.json 3、登陆成功之后就请求接口更新DictionariesEnum 数据 I、数组转json 字符串的应用案例 (lldb) po [[NSString alloc] initWithData: [NSJSONSerialization [[NSBundle mainBundle] pathForResource:@"searchEnum.json" ofType:nil]; // NSArray *array = [NSJSONSerialization NSData *data = [NSData dataWithContentsOfFile:filePath];//获取指定路径的data文件 id json = [NSJSONSerialization

    1K40发布于 2021-03-24
  • 来自专栏编程语言

    iOS:本地json文件读取、存储

    NSData *data = [[NSData alloc] initWithContentsOfFile:path]; // 对数据进行JSON格式化并返回字典形式 return [NSJSONSerialization filePath = [NSHomeDirectory() stringByAppendingString:@"/Documents/myJson.json"]; NSData *json_data = [NSJSONSerialization

    6.7K10发布于 2019-12-26
  • 来自专栏云原生布道专栏

    【IOS开发基础系列】数据编解码专题

    DataTOjsonString: (id)object { NSString*jsonString = nil; NSError *error; NSData *jsonData = [NSJSONSerialization 串转化为字典或者数组 - (id)toArrayOrNSDictionary: (NSData*)jsonData{ NSError *error = nil; id jsonObject = [NSJSONSerialization qingjoin/p/3437036.html 将NSString转换成UTF8编码的NSString http://blog.csdn.net/a6472953/article/details/8163016 NSJSONSerialization-JSON

    1.1K20编辑于 2022-03-08
  • 来自专栏DannyHoo的专栏

    iOS开发中上传JSON字符串到后台服务器

    转换思路:将某个对象先通过NSJSONSerialization转换成NSData对象,然后将这个NSData对象转换成字符串,这样得到的字符串就是JSON字符串。(是不是很简单!) )object{ NSString *jsonString = [[NSString alloc]init]; NSError *error; NSData *jsonData = [NSJSONSerialization object { NSString *jsonString = [[NSString alloc]init]; NSError *error; NSData *jsonData = [NSJSONSerialization

    1.8K10发布于 2018-09-13
  • 来自专栏码农的生活

    AFNetworking类库使用示例

    operation, id responseObject) { NSData *data = operation.responseData; NSDictionary *dict = [NSJSONSerialization NSURLSessionDataTask *task, id responseObject) { NSData *data = responseObject; NSDictionary *dict = [NSJSONSerialization

    73100发布于 2021-10-31
  • 来自专栏程序员读书笔记

    App与WebView交互方式

    parmeter——我们要传递给WKWebview中的参数,通常用NSJSONSerialization转化为字符串来传递。 该参数会在completionHandler的回调函数中以字符串返回,通常是用NSJSONSerialization来解析。

    1.7K20发布于 2019-08-14
  • 来自专栏Hello world

    Mac小工具开发问题记录

    sStr forType:NSStringPboardType]; 6.数组转字符串 NSData *sData = nil; NSString * sStr = nil; sData = [NSJSONSerialization stringByReplacingOccurrencesOfString:@"\\/" withString:@"/"]; data转换 NSData * sData = nil; NSString * sStr = nil; sData = [NSJSONSerialization

    84120发布于 2020-06-11
  • 来自专栏ShaoYL

    iOS - - JSON 和 XML解析

    NSNull JSON 转换为 OC数据类型 3.在iOS中,JSON的常见解析方案有4种 ①第三方框架:JSONKit、SBJson、TouchJSON(性能从左到右,越差) ②苹果原生(自带):NSJSONSerialization (性能最好) NSJSONSerialization的常见方法 JSON数据 -> OC对象 /* 第一个参数:需要解析的JSON数据 第二个参数:解析JSON的可选配置参数 JSONObjectWithData:(NSData *)data options:(NSJSONReadingOptions)opt error:(NSError **)error; iOS5自带解析类NSJSONSerialization 从response中解析出数据放到字典中 NSDictionary *weatherDic = [NSJSONSerialization JSONObjectWithData:response 查看复杂的JSON数据 ①在线转换,查看格式化 http://tool.oschina.net/codeformat/json ②直接将转换后的数据写到本地 NSDictionary *Dic = [NSJSONSerialization

    2.9K80发布于 2018-05-11
  • 来自专栏Helloted

    Runtime应用(一):Json转Model

    if ([json isKindOfClass:[NSData class]]) { jsonData = json; } // 如果时NSData类型,使用NSJSONSerialization jsonData && [jsonData isKindOfClass:[NSData class]]) { NSError *error = nil; dict = [NSJSONSerialization

    69740编辑于 2022-06-07
  • 来自专栏程序员充电站(itcharge)

    iOS网络--HTTP请求HTTP请求

    completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { NSLog(@"%@", [NSJSONSerialization completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { NSLog(@"%@", [NSJSONSerialization completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { NSLog(@"%@", [NSJSONSerialization

    3K80发布于 2018-05-31
  • 来自专栏python进阶学习

    网易云音频数据如何爬取?

    以下是一个简单的JSON解析示例: 复制 NSError *jsonError; NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData NSLog(@"Error: %@", error); } else { // 解析音频信息 NSDictionary *audioData = [NSJSONSerialization

    43410编辑于 2024-06-08
  • 来自专栏大师级码师

    iOS AFNetWorking 请求json数据

    operation.responseString; NSData* data=[html dataUsingEncoding:NSUTF8StringEncoding]; id dict=[NSJSONSerialization

    1.2K30发布于 2021-10-29
  • 来自专栏coding...

    iOS开发实战-时光记账Demo 网络版效果分析客户端部分服务端部分Demo地址简书主页

    = [[NSDictionary alloc] initWithObjectsAndKeys:userName,@"username", nil]; NSData *postData = [NSJSONSerialization if ([dataStr isEqualToString:@"0"]) { return ; } NSArray *jsonArray = [NSJSONSerialization NSArray *postArray = [[CoreDataOperations sharedInstance] getAllTallyWithArray]; NSData *postData = [NSJSONSerialization initWithObjectsAndKeys:username,@"username",psw,@"userpsw", nil]; //字典转json NSData *postData = [NSJSONSerialization initWithObjectsAndKeys:username,@"username",psw,@"userpsw", nil]; //字典转json NSData *postData = [NSJSONSerialization

    2.9K20发布于 2018-08-23
  • 来自专栏iOS 备忘录

    iOS开发知识点

    json string - (NSString *)convertJSONStringWithObject:(id)jsonObject {     NSData *jsonData;     if ([NSJSONSerialization isValidJSONObject:jsonObject]) {         NSError *error;         jsonData = [NSJSONSerialization dataWithJSONObject

    50350编辑于 2023-10-16
  • 来自专栏腾讯云智能·AI公有云

    网易云音频数据如何爬取?

    以下是一个简单的JSON解析示例: 复制 NSError *jsonError; NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData NSLog(@"Error: %@", error); } else { // 解析音频信息 NSDictionary *audioData = [NSJSONSerialization

    80010编辑于 2023-11-27
领券