Jay 0.1.2

Jay 0.1.2

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Feb 2016
SPMSupports SPM

Maintained by Honza Dvorsky.



Jay 0.1.2

Jay

Pure-Swift JSON parser. Linux & OS X ready. Replacement for NSJSONSerialization.

JSON Spec: Implemented from RFC4627

:question: Why?

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 😇

Features

  • [x] Parsing of JSON object from data
  • [ ] Formatting a JSON object into data

Usage

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)")
}

Installation

Swift Package Manager

.Package(url: "https://github.com/czechboy0/Jay.git", majorVersion: 0)

:gift_heart: Contributing

Please create an issue with a description of your problem or open a pull request with a fix.

:v: License

MIT

:alien: Author

Honza Dvorsky - http://honzadvorsky.com, @czechboy0