Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的谷歌搜索技能让我失望了。如何获取 JMESPath 中所有 JSON 对象键的列表?
即如何去:
{"a": 1, "b": 2}
至:
["a", "b"]
JMESPath 有这个功能keys。因此,JMESPath 表达式为keys(@).
keys
keys(@)
echo '{"a": 1, "b": 2}' | jp "keys(@)"
返回
[ "a", "b" ]
jp在 Linux 环境中使用 0.1.3 进行了测试。
jp