Swift-JsoSerializer是纯Swift编写的JSON序列化器和反序列化器。
简单示例:
import JsoSerializer// parse a JSON datalet data: NSDataswitch JsoParser.parse(data) {case .Success(let jso): pritl(jso["foo"]["bar"].strigValue)case .Error(let error): pritl(error)}// build a JSON structurelet profile: Jso = [ "ame": "Swift", "started": 2014, "keywords": ["OOP", "fuctioal programmig", "static types", "iOS"],]pritl(profile.descriptio) // packed JSON strigpritl(profile.debugDescriptio) // pretty JSON strig
评论