源码

iOS 保存测试数据为json

版权声明/uff1a本文为博主原创文章/uff0c遵循 CC 4.0 by-sa 版权协议/uff0c转载请附上原文出处链接和本声明。
本文链接/uff1ahttps://blog.csdn.net/u011018979/article/details/97629046

数组转json 字符串

(lldb) po [[NSString alloc] initWithData: [NSJSONSerialization dataWithJSONObject:tmp options:NSJSONWritingPrettyPrinted error:nil] encoding:NSUTF8StringEncoding]

json 转数组

NSString *path = [[NSBundle mainBundle] pathForResource:@"city.json" ofType:nil];

NSArray *array = [NSJSONSerialization JSONObjectWithData:[NSData dataWithContentsOfFile:path] options:NSJSONReadingMutableLeaves error:nil];

(0)

本文由 投稿者 创作,文章地址:https://blog.isoyu.com/archives/ios-baocunceshishujuweijson.html
采用知识共享署名4.0 国际许可协议进行许可。除注明转载/出处外,均为本站原创或翻译,转载前请务必署名。最后编辑时间为:8 月 24, 2019 at 01:09 上午

热评文章