Skip to content

Instantly share code, notes, and snippets.

@sloanlance
Last active March 22, 2024 18:05
Show Gist options
  • Star 79 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save sloanlance/c3bf746b6396f60d321f5535e1ced892 to your computer and use it in GitHub Desktop.
Save sloanlance/c3bf746b6396f60d321f5535e1ced892 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
@sloanlance
Copy link
Author

sloanlance commented Mar 22, 2024 via email

@sloanlance
Copy link
Author

sloanlance commented Mar 22, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment