JSON and YAML

Meta: short page. The defining characteristic is type-driven parsing — fromJSON produces values of the expected type. Open with that.

Parsing

let summary: Summary! = fromJSON("""{"name": "test", "count": 42}""")
let status: Status! = fromJSON("\"PASSED\"")
let cfg = fromYAML("name: foo\ncount: 1")

Serialization

Coercion during parsing

Common errors

All of these are catchable with try/catch (Errors: try, catch, raise).

Meta: A side-by-side "JSON in / Dang value out" table would be a nice teaching tool.