Yson
Example
class Person: Codable {
var name: String = ""
var age: Int = 0
}
let jsonStr = """
{"name":"Yang","age":99}
"""
if let a = YsonObject(jsonStr) {
a.put("age", 100)
let s = a.yson
print(s)
if let p: Person = Yson.fromYson(Person.self, a) {
print(p.name)
print(p.age)
let ss = p.toYsonObject.yson
print(ss)
}
}
Output:
{"name":"Yang","age":100}
Yang
100
{"name":"Yang","age":100}
Requirements
Installation
Yson is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'Yson'
Author
yangentao, [email protected]
License
Yson is available under the MIT license. See the LICENSE file for more info.