Skip to content

Instantly share code, notes, and snippets.

@squatto
Forked from sloanlance/jq_jsonl_conversion.md
Created May 7, 2025 18:51
Show Gist options
  • Save squatto/4e031012f5d2e6b9f932a258c5e73f14 to your computer and use it in GitHub Desktop.
Save squatto/4e031012f5d2e6b9f932a258c5e73f14 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