当前位置:网站首页>Swiftyjson parsing local JSON files
Swiftyjson parsing local JSON files
2022-06-12 02:07:00 【JH_ Cao】
SwiftyJSON
1. Local JSON file
[
{
"name": "hangge",
"age": 100,
"phones": [
{
"name": " company ",
"number": "123456"
},
{
"name": " family ",
"number": "001"
}
]
},
{
"name": "big boss",
"age": 1,
"phones": [
{
"name": " company ",
"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(" Telephone :",number)
}
}
边栏推荐
- 程序员应该如何解决买菜难问题?手把手带你利用无障碍辅助功能快速下单抢菜
- Advantages of Google ads
- MySQL高级部分知识点
- How to maximize the use of various matching methods—— Google SEM
- Wechat applet - a case of comparing the size of numbers
- Basedexclassloader
- Smartbi helps you solve the problem of losing high-value customers
- 消防栓监测系统毕业设计---论文(附加最全面的从硬件电路设计->驱动程序设计->阿里云物联网搭建->安卓APP设计)
- Leetcode 45 jump game II
- Make ads more relevant by searching for additional information about ads
猜你喜欢

What are the advantages of adaptive search advertising?

Explore performance optimization! Performance improvement from 2 months to 4 hours!

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

Is the bidding price fixed for each click?

The release of star ring kundb 2.2 provides a new choice for business systems with high concurrent transactions and queries

Smartbi helps you solve the problem of losing high-value customers

超图倾斜数据合并根节点后转3dtiles

ACL2022 | DCSR:一种面向开放域段落检索的句子感知的对比学习方法

Implementation scheme of iteration and combination pattern for general tree structure

混泥土(地面+墙面)+ 山体裂缝数据集汇总(分类及目标检测)
随机推荐
Three main factors determining advertising quality
“中国东信杯”广西大学第四届程序设计竞赛(同步赛)
The establishment and introduction of the announcement module of PHP development blog system
力扣解法汇总868-二进制间距
serialization and deserialization
php安全开发 12博客系统的 系统模块信息的修改
Linux(CentOS7)安裝MySQL-5.7版本
Google 搜索广告系列设置前有哪些准备工作?
lua 函数
力扣编程题-解法汇总
Wide match modifier symbol has been deprecated, do not use
力扣解法汇总699-掉落的方块
Redis cluster + sentinel mode + replicas
Software engineering course: Chapter 2 software problem definition and feasibility analysis after class exercises
如何为Excel中的单元格自动填充颜色
A mystery of the end of vagrant up
2022最全面的Redis事务控制(带图讲解)
没有文笔,大家多多包涵
What are the advantages of adaptive search advertising?
C language programming classic games - minesweeping