jsonl-tools
Why this exists
LLM agents and web tools emit JSON Lines everywhere — transcripts, logs,
tool output, eval results — but none of the editors I use supported the
format as such: at best a .jsonl file gets mis-highlighted as JSON and
flagged as one big syntax error. I especially wanted proper support in
BBEdit, which is what I reach for to preview files. So: JSON Lines /
NDJSON tooling built from a shared parsing core — a CLI, a Language
Server Protocol server, and editor integrations that consume them.
BBEdit is the first integration (a native compiled language module);
the packages themselves are editor-neutral.
This project is fully vibe coded — written end to end by Claude.
Layout
packages/jsonl-core(@sarvagnan/jsonl-core): line-by-line JSONL parsing, validation diagnostics, and normalizationpackages/jsonl-cli(@sarvagnan/jsonl-cli): command-line validation and formatting; installs thejsonlbinarypackages/jsonl-lsp(@sarvagnan/jsonl-lsp): stdio LSP server for diagnostics and formatting, usable from any LSP-capable editor (BBEdit, Neovim, Helix, Zed, Emacs, …); installs thejsonl-lspbinaryeditors/bbedit: BBEdit integration — compiled language module (syntax coloring, function menu with per-record summaries, Reformat Document, language guessing, LSP hookup) built against the official Bare Bones Language Module SDK, plus text filterseditors/zed: Zed extension — attachesjsonl-lsp(auto-installed from npm) to the JSON Lines language for diagnostics, formatting, record outlines, hover inspection, and code actions; requires thejsonlextension, which owns the language definition; see editors/zed/README.md
The packages are npm workspaces; everything below assumes npm install
has been run once at the root (it wires up the cross-package symlinks).
Requirements: Node ≥ 20; the BBEdit module additionally needs macOS with the Xcode command line tools.
CLI
jsonl validate file.jsonl
jsonl format file.jsonl
jsonl format --check file.jsonl
jsonl normalize < input.jsonl > output.jsonl
jsonl pretty-record < selected-record.jsonlDuring local development, run through Node directly:
node packages/jsonl-cli/bin/jsonl.js validate file.jsonlBy default, blank physical lines are invalid. Pass --allow-blank-lines to tolerate and skip them during normalization.
format prints normalized JSONL to stdout and does not modify files. format --check exits non-zero when input is invalid or not already normalized.
pretty-record expects exactly one selected JSONL record and prints expanded JSON for inspection.
Core API
import {
normalizeJsonLines,
parseJsonLines,
validateJsonLines
} from "@sarvagnan/jsonl-core";Diagnostics are reported with one-based line and column fields suitable for editor display.
LSP
jsonl-lsp --stdioInitial capabilities:
textDocument/publishDiagnosticstextDocument/formattingtextDocument/rangeFormattingtextDocument/hovertextDocument/codeAction
The server accepts initialization options under jsonl:
{
"jsonl": {
"allowBlankLines": false,
"finalNewline": "preserve"
}
}BBEdit
npm install # once, at the root
cd editors/bbedit/module && make test && make install # native language module
cd -
(cd packages/jsonl-cli && npm link) # jsonl on PATH
(cd packages/jsonl-lsp && npm link) # jsonl-lsp on PATHRelaunch BBEdit and open any .jsonl file. See
docs/bbedit-install.md for details, including the
text filters.
Tests
npm install # once, at the root
npm test # workspace packages + editor filter scripts
npm run test:module # compiled module: harness + reformat parity with the CLI
# (byte parity is over LF documents; in the editor the
# module preserves existing CR/CRLF line endings)