Skip to content

Instantly share code, notes, and snippets.

@Raimondi
Forked from sloanlance/jq_jsonl_conversion.md
Created April 3, 2025 22:17
Show Gist options
  • Save Raimondi/22c172710279ef4721679c939b051886 to your computer and use it in GitHub Desktop.
Save Raimondi/22c172710279ef4721679c939b051886 to your computer and use it in GitHub Desktop.
jq: JSONL ↔︎ JSON conversion

jq: JSONL ↔︎ JSON conversion

Prerequisites

  • jqhttps://jqlang.github.io/jq/ — "like sed for JSON data"

    There are several options available for installing jq. I prefer to use Homebrew: brew install jq

  1. JSONL → JSON

    jq -s '.' input.jsonl > output.json
  2. JSON → JSONL

    jq -c '.[]' input.json > output.jsonl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment