JSON data
Variables annotated : json accept inline object and array literals with
unquoted keys. The json module then reads and edits them.
import json
// Inline literal — identifier keys are quoted automatically
let user: json = {
name: "alice",
age: 30,
roles: ["admin", "editor"]
}
// Read values
println(json.get(user, "name")) // "alice"
println(json.getInt(user, "age")) // 30
println(json.has(user, "email")) // false
// Edit (each call returns a new JSON string)
let updated = json.setString(user, "name", "bob")
let merged = json.merge(user, "{\"active\": true}")
// Pretty-print
println(json.pretty(merged))
Useful helpers: parse, valid, minify, keys, length, arrayGet,
delete, and the typed getters getInt / getBool.