feat(jsontools): add tools to pretty print json-lines (ndjson) (#10176)

Co-authored-by: Marc Cornellà <hello@mcornella.com>
This commit is contained in:
Eduardo Flores
2021-09-10 17:52:00 -05:00
committed by Marc Cornellà
parent b590939637
commit 7ded6752fd
2 changed files with 48 additions and 9 deletions

View File

@ -101,5 +101,13 @@ print(unquote_plus(sys.stdin.read()))
}
;;
esac
unset JSONTOOLS_METHOD
## Add NDJSON support
function {pp,is,urlencode,urldecode}_ndjson() {
local json jsonfunc="${0//ndjson/json}"
while read -r json; do
$jsonfunc <<< "$json"
done
}