用一些json传递消息,我希望能够在比较对象中添加通配符,因此:
curl example.com/json | jq 'select(.[].properties.type == "dev*")'
因此它将以“ dev”开头的类型打印出任何内容
IE: development, devel, devil
使用jq可以吗?
您可能会考虑startswith()函数。使用您的示例:
curl example.com/json | jq '.[].properties | select(.type | startswith("dev"))'
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句