yaml_parse
Parse a YAML string into a JSON object.
Parameters
- inputstringone of
inputorsource_key - YAML string; supports
${ctx.key}interpolation. - source_keystringone of
inputorsource_key - Context key containing the YAML string.
- output_keystringdefault "yaml_data"
- Context key for the parsed JSON output.
Providing both
inputandsource_keyis an error.
Context Output
<output_key>(defaultyaml_data) — the parsed JSON value.
Example
local flow = Flow.new("parse_yaml")
flow:step("parse", nodes.yaml_parse({
input = "name: Alice\nage: 30\ntags:\n - rust\n - lua",
output_key = "config"
}))
flow:step("done", nodes.log({
message = "Config: ${ctx.config}"
})):depends_on("parse")
return flow