gpt4 book ai didi

json - 小写 JSON 中的值

转载 作者:行者123 更新时间:2023-12-05 02:06:47 28 4
gpt4 key购买 nike

我有一个 json 文件,我正在寻找一个值的小写部分 - 我可以 jq 值和小写字符串,但我如何确保这个新的小写值被添加回整个文件?

jq '.[].Id' file.json | awk '{print tolower($0)}'  

上面只是小写了 ID 值,但现在我还需要将它们写回到正确的位置。

最佳答案

使用 update operatorascii_downcase内置。

jq '.[].Id |= ascii_downcase' file

关于json - 小写 JSON 中的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62454640/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com