Converts json to ndjson, New Line Delimited JSON.
# Install with go
go install github.com/do-i-need-a-username/j2ndj@latest
# find install path
which j2ndj
/Users/myuser/go/bin/j2ndj
# stdin t ostdout
cat input.json | ./bin/j2ndj
{"age":30,"city":"New York","name":"John Doe"}
{"age":28,"city":"Los Angeles","name":"Jane Doe"}
{"age":35,"city":"Chicago","name":"Bob Smith"}
# stdin to output file
cat input.json | ./bin/j2ndj -output=./output.ndjson
# input file to stdout
./bin/j2ndj -input=./input.json
{"age":30,"city":"New York","name":"John Doe"}
{"age":28,"city":"Los Angeles","name":"Jane Doe"}
{"age":35,"city":"Chicago","name":"Bob Smith"}
# input file to output file
./bin/j2ndj -input=./input.json -output=./output.ndjson
Use jq to convert json to ndjson
jq -c '.[]' input.json > output.ndjson