且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用jq将当前日期和时间附加到现有的json文件中

更新时间:2023-09-13 16:37:40

众多可能性之一:

$ jq --arg date $(date +"%r") '. + {date: $date}'

p.s. jq程序可以写为:

p.s. The jq program could be written as:

. + {$date}

p.p.s.与其不断询问使用jq是否有可能,您可能会发现花费更多的时间来更加熟悉jq.官方手册是一个很好的参考: https://stedolan.github.io/jq/manual/

p.p.s. Rather than continually asking whether something is possible using jq, you might find it a better investment of your time to become more familiar with jq. A good reference is the official manual: https://stedolan.github.io/jq/manual/