Convert YAML to JSONL

Turn YAML files into JSONL. Each entry of a top-level list becomes one line of compact JSON, and any other value becomes a single line, with values and key order kept.

Converted in an isolated sandbox on our serversDeleted after 24 hours

Drop YAML files on the dialor turn it to pick what to do

One JSON object per line.A top-level YAML list becomes one line per entry, with values and key order kept.

  1. What you get

    A single JSONL file. Each entry of a top-level list becomes one line of compact JSON. Any other value, such as a mapping, becomes a single line.

    Values and key order are kept as they were in the YAML.

  2. What changes

    Several documents in one YAML file become a list. Aliases are expanded, so each place that used an alias holds the full value. Comments are dropped.

    Values such as yes, on, 0755 and dates stay text. They are not turned into booleans, numbers or dates.

    A merge key (<<) is kept as an ordinary key instead of being merged. The keys it would have pulled in are not copied into the mapping.

  3. When it stops

    A file that cannot be parsed stops the conversion with input_corrupted. This is the code you get when the YAML is not valid.

    To go the other way, use JSONL to YAML.

YAML and JSONL.What each format is.

The formats

From · YAML

YAML

YAML configuration and data files.

Extensions
.yaml .yml
MIME type
application/yaml
Kind
Text and data
To · JSONL

JSON Lines

JSON Lines, one JSON object per line, the format of logs and datasets.

Extensions
.jsonl .ndjson
MIME type
application/jsonl
Kind
Text and data

In your code.The same YAML to JSONL conversion through the API, for your app or your agent.

terminal
$ cv convert report.yaml report.jsonl
$ cv convert report.yaml report.jsonl

Questions.What people ask about YAML to JSONL.

01OF 04

Each entry of a top-level list becomes one line of compact JSON. The order of the entries is kept.

They are dropped. The keys and values are written, and the comments are not.

No. The merge key is kept as an ordinary key instead of being merged.

The file could not be parsed. The conversion stops with input_corrupted when that happens.

More conversions.Other ways in and out of YAML and JSONL.