jqでJSONをクリーンアップする方法は?

jqでJSONをクリーンアップする方法は?

コマンドjq . generaldq_tabelas_novas.jsonはアイデンティティです。必要ですが、-ncオプションがあります...しかし何-nでも-nc null 値を返します。存在するjq -nc . generaldq_tabelas_novas.json

そうだ抜け穴なぜなら--help​   jq [オプション]フィルタファイル

ベストアンサー1

からman jq

   o   --null-input/-n:

       Don't read any input at all! Instead, the filter is run once using
       null as the input. This is useful when using jq as a simple
       calculator or to construct JSON data from scratch.

つまり、jqファイルを使用するときにファイルを読み取ることもできません。-nシノプシスには次のように記載されているので、これはエラーではありません。

jq [options...] filter [files...]

つまり、ファイルオペランドはオプションです。

コンパクトな出力には、次のものを使用する必要があります。

jq -c . generaldq_tabelas_novas.json >newfile.json

おすすめ記事