Swift 封装器 Jasoom

码农软件 · 软件分类 · 其他(Others) · 2019-07-17 16:29:33

软件介绍

Jasoom 是一个使用方便,类型安全 的NSJSONSerialization 
 Swift 封装器。

JSON 解析:

do {
    let json = try JSON.parseData(data)

    if json["name"].isUndefined {
        throw .MissingName
    }

    if json["info"]["age"].isUndefined {
        throw .MissingAge
    }

    let model = MyModel(
        name: json["name"].stringValue!
        age: json["info"]["age"].intValue!
        married: json["status"]["married"].boolValue ?? false
        firstCar: json["cars"][0].stringValue ?? ""
    )
}
catch {
    // Handle error
}

JSON 生成:

var object = JSON.object()
object["name"] = .String("Bob Smith")
object["info"] = JSON.object()
object["info"]["age"] = .Number(10)
object["status"] = JSON.object()
object["status"]["married"] = .Number(true)
object["cars"] = JSON.array()
object["cars"].append(.String("Ford Mustang"))

do {
    let data = try object.generateData()
}
catch {
    // Handle error
}

本文地址:https://codercto.com/soft/d/10342.html

Database Design and Implementation

Database Design and Implementation

Edward Sciore / Wiley / 2008-10-24 / 1261.00 元

* Covering the traditional database system concepts from a systems perspective, this book addresses the functionality that database systems provide as well as what algorithms and design decisions will......一起来看看 《Database Design and Implementation》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换