Parse YAML in Larzscript
Parse a YAML document (nested mappings, lists of scalars) into real Larzscript data.
A deliberately honest subset - no anchors, no flow style, no multi-document files - covering the config-file shape YAML is actually used for most often.
larzscript pkg install yaml
Code
import "yaml" as yaml
let data = yaml.parse("name: Ada\nage: 36\ntags:\n - dev\n - admin\n")
print(data["name"], data["age"])
print(data["tags"])Output
Ada 36 [dev, admin]
Related
larzyamlLightweight YAML-subset parse/stringify→Parse JSON in LarzscriptParse a JSON string into real Larzscript dicts and lists, and turn data back into JSON text.→Read and Parse a CSV File in LarzscriptParse CSV text into rows, or straight into dicts keyed by header - including quoted fields with embedded commas.→Encode and Decode Base64 in LarzscriptBase64-encode arbitrary text (or decode it back), the standard way binary-ish data travels safely through text-only channels like JSON or URLs.→