SkillAgentSearch skills...

JSONParsing

No description available

Install / Use

/learn @Vadim-Yelagin/JSONParsing
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

JSONParsing Carthage compatible

Usage example:

struct Page<T: JSONParsing> {
	var page: Int = 0
	var pageSize: Int = 0
	var total: Int = 0
	var previous: String?
	var next: String?
	var content: [T] = []
}

extension Page: JSONParsing {
	static func parse(json: JSON) throws -> Page {
		return try Page(
			page: json["page"]^,
			pageSize: json["pageSize"]^,
			total: json["total"]^,
			previous: json["previous"].optional.map(^),
			next: json["next"].optional.map(^),
			content: json["content"].array.map(^)
		)
	}
}

View on GitHub
GitHub Stars4
CategoryDevelopment
Updated9y ago
Forks8

Languages

Swift

Security Score

65/100

Audited on Nov 1, 2016

No findings