C7 conformance for Jay
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Sources
.gitignore
.swift-version
.travis.yml
LICENSE
Package.swift
README.md

README.md

Jay-C7

Build Status Latest Release Platforms Package Managers

Blog Twitter Czechboy0

C7 conformance for Jay.

If you want to use C7.JSON type with Jay in your project, just use this package, which automatically includes the appripriate Jay version.

Usage

Parsing from data (deserialization)

do {
	//get data from disk/network
	let data: [UInt8] = ...

	//ask Jay to parse your data
	let json = try Jay().c7jsonFromData(data) // C7.JSON

	//if it doesn't throw an error, all went well
	if let tasks = json.dictionary?["today"]?.array {
	    //you have a dictionary root object, with an array under the key "today"
	    print(tasks) //["laundry", "cook dinner for gf"]
	} 
} catch {
	print("Parsing error: \(error)")
}

Formatting into data (serialization)

do {

	let json: JSON = ... // C7.JSON
	let data = try Jay(formatting: .prettified).dataFromC7Json(json: json) // [UInt8]

	//send data over network, save to disk
} catch {
	print("Formatting error: \(error)")
}

Installation

Swift Package Manager

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

💝 Contributing

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

✌️ License

MIT

👽 Author

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