YamlToJson
Convert a YAML file into JSON or JSONL.
If jsonl = true, each YAML document (---) becomes one JSON line.
If jsonl = false, output becomes:
- a JSON array when there are multiple YAML documents
- a single JSON object when there is exactly one document
- a JSON array when the YAML is a list
yaml
type: "io.kestra.plugin.serdes.yaml.YamlToJson"Examples
Convert a YAML file into JSONL
yaml
id: yaml_to_json
namespace: company.team
tasks:
- id: write_yaml
type: io.kestra.plugin.core.storage.Write
extension: yaml
content: |
---
name: Apple
price: 1.2
---
name: Banana
price: 0.9
- id: to_jsonl
type: io.kestra.plugin.serdes.yaml.YamlToJson
from: "{{ outputs.write_yaml.uri }}"
jsonl: true
Properties
from *Requiredstring
Source file URI
Pebble expression referencing an Internal Storage URI e.g. {{ outputs.mytask.uri }}.
charset string
Default
UTF-8The name of a supported charset
jsonl booleanstring
Default
falseProduce JSONL
If true, then one JSON per line. If false, then produce array/object.
Outputs
uri string
Format
uriURI of the output file
Metrics
records counter
Number of YAML documents converted