Skip to content

Type to search extensions

JSONL

v0.1.1

JSON Lines (JSONL) syntax highlighting support for Zed

Updated 8 months ago
49k downloads 3 stars Repository ↗

JSONL Syntax - Zed Extension

A Zed editor extension that provides syntax highlighting for JSON Lines (JSONL) and Newline Delimited JSON (NDJSON) files.

Overview

JSON Lines is a format for storing structured data with one JSON object per line. Each line is a valid JSON value, making it suitable for streaming and processing large datasets.

{"name": "John", "age": 30}
{"name": "Jane", "age": 25}
{"name": "Bob", "age": 35}

Features

  • Syntax highlighting for .jsonl and .ndjson files
  • Automatic file detection
  • Tree-sitter JSON parser for accurate highlighting
  • 2-space indentation default
  • Bundled pretty-print formatter
  • Performance optimized for large files

Installation

Development Installation

  1. Clone this repository:

    git clone https://github.com/[your-username]/jsonl-syntax
    cd jsonl-syntax
  2. In Zed, open command palette (Cmd+Shift+P / Ctrl+Shift+P)

  3. Run "zed: install dev extension" and select the jsonl-syntax folder

Usage

Open any .jsonl or .ndjson file in Zed to see syntax highlighting automatically applied.

Pretty-Print JSONL

Run Zed's editor: format command from a .jsonl or .ndjson file to pretty-print JSON Lines buffers with the bundled formatter.

The formatter parses the buffer as a stream of JSON values, so it can format both compact JSONL and previously pretty-printed multi-line records. To format automatically on save, enable Zed's format_on_save setting for JSON Lines.

Development

Project Structure

jsonl-syntax/
├── extension.toml          # Extension configuration
├── languages/
│   └── jsonl/
│       ├── config.toml     # Language settings
│       └── highlights.scm  # Highlighting rules
├── server/
│   └── jsonl-lsp.js        # Bundled formatter language server
├── src/
│   └── lib.rs              # Zed extension entrypoint
├── sample.jsonl           # Test file
└── tests/
    ├── jsonl_formatter.test.js
    └── jsonl_lsp.test.js

Making Changes

  1. Edit highlighting rules in languages/jsonl/highlights.scm
  2. Modify language settings in languages/jsonl/config.toml
  3. Reload extensions in Zed: "zed: reload extensions"
  4. Test changes with sample files

Contributing

Contributions are welcome.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

Technical Details

This extension uses the tree-sitter-json grammar for parsing. Each JSONL line is treated as a separate JSON document for highlighting purposes.

License

MIT License - see LICENSE file for details.

ZedExt An unofficial community project. Not affiliated with Zed Industries.

Data from Zed’s extension registry and GitHub · updated