当前位置:网站首页>SwiftyJSON解析本地JSON文件
SwiftyJSON解析本地JSON文件
2022-06-12 02:06:00 【JH_Cao】
SwiftyJSON
1. 本地JSON文件
[
{
"name": "hangge",
"age": 100,
"phones": [
{
"name": "公司",
"number": "123456"
},
{
"name": "家庭",
"number": "001"
}
]
},
{
"name": "big boss",
"age": 1,
"phones": [
{
"name": "公司",
"number": "111111"
}
]
}
]
2. demo
override func viewDidLoad() {
super.viewDidLoad()
let path = Bundle.main.path(forResource: "testData", ofType: "json")!
let testData = NSData(contentsOfFile: path)
let json = try! JSON(data: testData! as Data)
if let number = json[0]["phones"][0]["number"].string {
print("電話:",number)
}
}
边栏推荐
- Wechat applet - a case of comparing the size of numbers
- C language programming classic games - minesweeping
- 国资入股,建业地产这回稳了吗?
- How to locate keywords to make advertising accurate.
- Introduction to SVM
- 力扣解法汇总-剑指 Offer II 114. 外星文字典
- How WPS inserts a directory and the operating steps for quickly inserting a directory
- Pagination writing of PHP security open 10 article list module
- The establishment and introduction of the announcement module of PHP development blog system
- [adjustment] in 2022, the Key Laboratory of laser life sciences of the Ministry of education of South China Normal University enrolled adjustment students in optics, electronic information, biomedicin
猜你喜欢

CVPR2022 | iFS-RCNN:一种增量小样本实例分割器

消防栓监测系统毕业设计---论文(附加最全面的从硬件电路设计->驱动程序设计->阿里云物联网搭建->安卓APP设计)

ozzanimation-基於sse的動作系統

Software engineering - system flow chart

Redis實現消息隊列的4種方案

为什么我们要使用谷歌搜索广告?

Summary of concrete (ground + wall) + Mountain crack data set (classification and target detection)

leetcode:6. Zigzag transformation

The establishment and introduction of the announcement module of PHP development blog system

阿里云oss文件上传系统
随机推荐
ACL2022 | DCSR:一种面向开放域段落检索的句子感知的对比学习方法
Three main factors determining advertising quality
adb命令 利用jks文件给apk签名
“中国东信杯”广西大学第四届程序设计竞赛(同步赛)
力扣解法汇总732-我的日程安排表 III
leetcodeSQL:612. Nearest distance on plane
How WPS inserts a directory and the operating steps for quickly inserting a directory
Graphic data analysis | business cognition and data exploration
State owned assets into shares, has Jianye real estate stabilized?
How to maximize the use of various matching methods—— Google SEM
Leetcode 45 jump game II
Comprehensive quality of teaching resources in the second half of 2019 - subjective questions
C language programming classic games - minesweeping
Database
Is there a female Bluetooth headset suitable for girls? 38 Bluetooth headsets worth getting started
力扣解法汇总436-寻找右区间
如何为Excel中的单元格自动填充颜色
Niuke monthly race 14- simple counting
Summary of concrete (ground + wall) + Mountain crack data set (classification and target detection)
2022 blind box applet app has become a new drainage outlet for enterprises