YamlToJson​Yaml​To​Json

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"

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

Source file URI

Default UTF-8

The name of a supported charset

Default false

Produce JSONL

If true, then one JSON per line. If false, then produce array/object.

Format uri

URI of the output file

Number of YAML documents converted