YAML to NDJSON Converter
Explains how to represent YAML lists as NDJSON (one JSON object per line) with practical examples.
Copiado!
Suporta lista de objetos planos (sem aninhamento).
NDJSON (newline-delimited JSON) é um objeto JSON por linha. Para um arquivo YAML do tipo lista:
- nome: Ana\n idade: 30\n- nome: Beto\n idade: 25O equivalente NDJSON é:
{"nome":"Ana","idade":30}\n{"nome":"Beto","idade":25}Use yq ou js-yaml em pipelines para esta conversão.
YAML lists rewritten one record per line
You have a YAML file holding a list of records and the next tool in the pipeline wants NDJSON: one JSON object per line, no trailing commas, no wrapping brackets. That is the shape jq, BigQuery and most log loaders expect. Paste the list into the top box and the conversion appears immediately, one line per item, ready to grab with the copy button.
The parser here is deliberately small and is not a full YAML implementation. It looks for lines starting with a dash to open a new record, and indented key: value lines to add fields to the record currently open. Values go through a light type pass: true, false, null and the tilde become literals, integers and decimals become numbers, and matching single or double quotes at the ends are stripped.
That is why the scope is a list of flat objects. A nested map does not become a nested object: the parent key ends up as an empty string and its children get promoted to the same level, which is easy to miss. Inline lists like [a, b] stay text, a comment containing a colon becomes a field, and a file that opens with a mapping instead of a dash produces nothing. For real files use yq or js-yaml. Nothing leaves your browser.
Frequently asked questions
Does it handle nested YAML?
Why did my file produce no output at all?
Are numbers in scientific notation converted?
Related Tools
JSON to YAML
Convert JSON data to YAML format.
YAML to JSON
Convert YAML data to JSON format.
CBOR to JSON (text) Converter
Explains CBOR (RFC 8949), its types and how to represent compact binary values in textual JSON.
JSON to TypeScript
Convert a JSON to TypeScript interfaces with automatically inferred types. Detects strings, numbers, booleans, arrays, nested objects and union types. Everything in your browser.
JSON Lines → CSV
Convert JSONL (NDJSON) file to CSV, deriving headers from the union of all observed object keys.
YAML to JSON Converter
Convert YAML to JSON right in your browser, with no data sent to any server. Paste the YAML and copy ready-to-use JSON for APIs, configs and scripts.