SmartQueryTools

Convert YAML to NDJSON Online

Convert YAML files to NDJSON format directly in your browser. No upload required — your data never leaves your device.

About converting YAML to NDJSON

Converting YAML to NDJSON puts each record on its own line as a compact JSON object. The usual reason is a loader that ingests line by line. BigQuery and Snowflake load jobs, mongoimport, and many message queues and log pipelines work this way. A YAML list of fixtures, catalogue entries or events can be loaded in one step instead of being posted item by item.

Unlike CSV output, NDJSON keeps nesting. A nested mapping stays a nested object on the line, and a YAML list stays a JSON array. Every line gets the same set of keys. A key missing from one record is added with the value null, which gives BigQuery or Snowflake a consistent schema to detect.

The input should be a list of records. Several --- separated documents are fine and simply add more lines. Comments are lost and anchors are expanded, so a shared default block referenced with *defaults is repeated in full on every line that uses it. That can make the NDJSON file much larger than the YAML. Unquoted dates arrive as timestamp strings with a trailing Z. Quote them in the source if the loader should treat them as dates.

Worked example

A small orders export with an ID, a customer name, a date, an amount (one missing) and a true/false flag, converted with the default settings.

Input (YAML)

- order_id: 1001
  customer: Acme Ltd
  order_date: '2026-03-02'
  amount: 249.5
  shipped: true
- order_id: 1002
  customer: Brightside Co
  order_date: '2026-03-02'
  amount: 1200
  shipped: false
- order_id: 1003
  customer: Acme Ltd
  order_date: '2026-03-05'
  amount: 89.99
  shipped: true
- order_id: 1004
  customer: Northwind
  order_date: '2026-03-07'
  amount: null
  shipped: false

Output (NDJSON)

{"order_id":1001,"customer":"Acme Ltd","order_date":"2026-03-02","amount":249.5,"shipped":true}
{"order_id":1002,"customer":"Brightside Co","order_date":"2026-03-02","amount":1200,"shipped":false}
{"order_id":1003,"customer":"Acme Ltd","order_date":"2026-03-05","amount":89.99,"shipped":true}
{"order_id":1004,"customer":"Northwind","order_date":"2026-03-07","amount":null,"shipped":false}

What changes when you convert YAML to NDJSON

  • Each item in the YAML list becomes one line holding one JSON object.
  • There is no surrounding array and no comma between lines.
  • Nested mappings and sequences stay nested inside each line.
  • order 1004's line contains "amount":null, and every line has the same keys.
  • The quoted YAML date '2026-03-02' is written as "2026-03-02".

Your file is processed locally in your browser and is never uploaded. The free limit is 50 MB per file; larger files work if your device has the memory for them.

Frequently Asked Questions

Why is my NDJSON file so much larger than the YAML?

Anchors and aliases are expanded, so shared blocks are copied into every record that references them. JSON also repeats every key on every line. Both are normal for NDJSON.

Does NDJSON keep nested YAML structure?

Yes. Nested mappings stay objects and lists stay arrays inside each line. Only the top-level list is split into separate lines.

My YAML has a top-level key holding the list. What happens?

The whole file becomes a single NDJSON line, with the list nested inside it. Remove the top-level key and outdent the list first so each record becomes its own line.

What is NDJSON format?

NDJSON (Newline-Delimited JSON) stores one JSON object per line, making it easy to stream, append, and process incrementally.

Related Tools