TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Feb 2016 |
SPMSupports SPM | ✓ |
Maintained by Honza Dvorsky.
Pure-Swift JSON parser. Linux & OS X ready. Replacement for NSJSONSerialization.
JSON Spec: Implemented from RFC4627
We all use JSON. Especially when writing server-side Swift that needs to run on Linux. #0dependencies
NSJSONSerialization
is not yet fully implemented in the Swift standard libraries, so this is my take on how parsers should work. This is not another JSON mapping utility library. This is an actual JSON parser. Check out the code, it was fun to write
do {
//get data from disk/network
let data: [UInt8] = ...
//ask Jay to parse your data
let json = try Jay().jsonFromData(data)
//if it doesn't throw an error, all went well
if let dictionary = json as? [String: Any] {
//you have a dictionary root object
} else if let array = json as? [Any] {
//you have an array root object
}
} catch {
print("Parsing error: \(error)")
}
.Package(url: "https://github.com/czechboy0/Jay.git", majorVersion: 0)
Please create an issue with a description of your problem or open a pull request with a fix.
MIT
Honza Dvorsky - http://honzadvorsky.com, @czechboy0