SmartQueryTools

Convert NDJSON to YAML Online

Convert NDJSON files to YAML directly in your browser. Download clean, human-readable YAML — no upload required.

About converting NDJSON to YAML

NDJSON to YAML is a reading aid more than a storage choice. A JSON Lines record packed onto one line, with a nested request object and a long message, is hard to scan. The same record as YAML puts each key on its own line, indents nested objects, and shows multi-line strings such as stack traces as literal blocks that read like the original text.

That makes it useful for pasting a handful of events into an incident write-up, a runbook or a code review, and for turning a sample of JSONL test cases into a YAML fixture file that people will edit by hand. Each input line becomes one item in a top-level YAML list, in the same order as the file.

YAML is not a good home for a whole log file. It is slow to parse and verbose, and the output repeats every key on every record, with null where a line lacked it. Take the Head or a Sample of the NDJSON first, and convert just the records you want people to read. Timestamps such as 2026-03-02T14:05:11.042Z are single-quoted so loaders like PyYAML do not turn them into datetime objects.

Worked example

A small sample file, converted with the default settings.

Input (NDJSON)

{"ts":"2026-03-02T14:05:11.042Z","level":"info","service":"checkout","status":200,"latency_ms":41.7,"user_id":"u_1842"}
{"ts":"2026-03-02T14:05:12.310Z","level":"error","service":"checkout","status":502,"latency_ms":3012.4,"user_id":null}
{"ts":"2026-03-02T14:05:12.877Z","level":"info","service":"search","status":200,"latency_ms":12.9,"user_id":"u_0077"}
{"ts":"2026-03-02T14:05:14.105Z","level":"warn","service":"search","status":429,"latency_ms":0.8,"user_id":"u_1842"}

Output (YAML)

- ts: '2026-03-02T14:05:11.042Z'
  level: info
  service: checkout
  status: 200
  latency_ms: 41.7
  user_id: u_1842
- ts: '2026-03-02T14:05:12.310Z'
  level: error
  service: checkout
  status: 502
  latency_ms: 3012.4
  user_id: null
- ts: '2026-03-02T14:05:12.877Z'
  level: info
  service: search
  status: 200
  latency_ms: 12.9
  user_id: u_0077
- ts: '2026-03-02T14:05:14.105Z'
  level: warn
  service: search
  status: 429
  latency_ms: 0.8
  user_id: u_1842

What changes when you convert NDJSON to YAML

  • Each line becomes one list item that starts with "- ts:".
  • Timestamps are single-quoted, as in ts: '2026-03-02T14:05:11.042Z'.
  • The null user_id on the error line is written as user_id: null.
  • Strings containing line breaks, such as stack traces, are written as |- literal blocks.
  • Nested objects become indented mappings, and arrays become lists of - items.

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 are my timestamps in quotes?

Unquoted, 2026-03-02T14:05:11.042Z is a YAML timestamp, and many loaders would turn it into a date object. Quoting keeps it a string, which matches what it was in the NDJSON.

Can I convert the YAML back to NDJSON later?

Yes, with the YAML to NDJSON converter. Quoted timestamps come back as strings, and the nulls added for missing keys stay in the records.

Does each YAML item match one line of the input?

Yes. Item one is line one, and so on. Blank lines in the NDJSON are skipped, so they do not produce empty items.

Related Tools