Jq: echo pipe to jq to file

Created on 13 Oct 2016  路  4Comments  路  Source: stedolan/jq

Hey, this is probably answered somewhere already, but how can I get the following to work?

echo '{"json":"value"}' | jq > file

I use jq to format/validate JSON strings, and it's not always feasible to copy from a terminal.

Thanks

Most helpful comment

Use jq . instead of jq.

All 4 comments

Use jq . instead of jq.

thanks, I figured it had to be something simple!

IHMO, in non interactive mode it would make sense to set -M and . filter by default

@rzr If we ever touch this again it will be to make a program (., whatever) an absolute requirement whether you're using pipes or ttys.

Was this page helpful?
0 / 5 - 0 ratings