Skip to content
This repository has been archived by the owner on Mar 23, 2021. It is now read-only.

endocrimes/Jay-C7

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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