json2jsonl

A tiny Go CLI that converts JSON to JSONL, turning one or many JSON files into a single JSONL (JSON Lines) stream. Output goes to stdout by default so it composes cleanly with grep, jq, and the rest of your Unix toolbox.

json2jsonl data1.json data2.json > out.jsonl

One tool, the way Unix wants it

Synopsis

The whole interface, on one line.

json2jsonl [options] <file1.json> <file2.json> ...

  -o string   write output to this file
              instead of stdout
  -h          print this help

Pipe into anything

Default output goes to stdout — compose with the rest of your toolbox.

json2jsonl events-*.json \
  | grep '"level":"error"' | wc -l

json2jsonl users.json \
  | jq -c 'select(.active == true)'

cat huge.json | json2jsonl - | head -100

Batch many files

Concatenate any number of inputs into a single ordered stream.

# Combine a directory of JSON files into one .jsonl
json2jsonl -o all.jsonl logs/2026-*.json

# Same idea, glob expanded by the shell
json2jsonl -o all.jsonl logs/*.json

Write to a file

Use -o when you want a file on disk.

json2jsonl -o output.jsonl data1.json data2.json
# → output.jsonl  (one JSON object per line)

Exactly the shape a CLI should be

Pipe-friendly by default

No output flag? Output goes straight to stdout. Compose with grep, jq, awk, or anything else in your shell — no temp files, no ceremony.

Batch in one command

Pass any number of input files. An object becomes one JSONL record and a JSON array one record per item, all in a single ordered stream.

Pre-built binaries

Single static binary for the four major desktop targets — macOS Apple Silicon, macOS Intel, Linux x86_64, Windows x86_64. No Go toolchain required.

Fast and small

Written in Go. Launches instantly, processes large inputs without bloating memory. Drop it into a CI step without thinking about it.

Two flags, that's it

-o writes to a file instead of stdout. -h prints help. The whole interface fits in your head.

Free, MIT-style

Free to use for any purpose, source code on GitHub. No telemetry, no licence dance.