Iatheto

2.0

A simple JSON framework
Prosumma/Iatheto

What's New

Swift 4.2 @dynamicMemberLookup

2018-08-08T14:16:28Z

Iatheto

Iatheto is a minimal JSON framework that serializes to and from Apple's Codable. By now there are many such frameworks, but Iatheto is one of the oldest — it predates Codable — with a very tiny implementation.

Iatheto supports only those types directly supported by JSON and no others. To handle a date, for instance, you must first turn it into a string.

Encoding

Iatheto's JSON type supports initialization by many kinds of literals, so the syntax is natural.

let json: JSON = ["first_name": "Murray", "last_name": "Rothbard", "born": 1926, "died": 1995]
let encoder = JSONEncoder()
let data = try encoder.encode(json)

Decoding

Decoding is as straightforward as encoding:

let decoder = JSONDecoder()
let json = try decoder.decode(JSON.self, from: data)

What's a Iatheto?

"Iatheto" comes from the Greek ἰαθήτω, "she shall be healed", which in turn comes the verb ἰάομαι "to heal". This verb is the origin of the name Ἰάσων "Jason".

Description

  • Swift Tools
View More Packages from this Author

Dependencies

  • None
Last updated: Fri Oct 18 2024 13:09:54 GMT-0900 (Hawaii-Aleutian Daylight Time)