Skip to content

Instantly share code, notes, and snippets.

@dolmen
Created July 3, 2018 16:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dolmen/3f606509b156ca4ce1b29f56abe98606 to your computer and use it in GitHub Desktop.
Save dolmen/3f606509b156ca4ce1b29f56abe98606 to your computer and use it in GitHub Desktop.
Transform a JSON input containing a single array into the "JSON Lines" format
#!/usr/local/bin/jq -cf
# This script transforms a JSON input containing a single array into the "JSON Lines" format (http://jsonlines.org)
# See https://stackoverflow.com/questions/42178636/how-to-use-jq-to-output-jsonl-one-independent-json-object-per-line
#
# Install:
# - save this file as "jsonl"
# - install jq (https://stedolan.github.io/jq/)
# - chmod u+rx jsonl
#
# Usage:
# jsonl <file.json>
.[]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment