Skip to content

Instantly share code, notes, and snippets.

@jet10000
Forked from sloanlance/jq_jsonl_conversion.md
Created July 26, 2024 13:04
Show Gist options
  • Save jet10000/1a1a36d2d3464d8227bfda8c9c91bf05 to your computer and use it in GitHub Desktop.
Save jet10000/1a1a36d2d3464d8227bfda8c9c91bf05 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