html tool

2018年8月6日星期一

jq get json keys



https://stackoverflow.com/questions/23118341/how-to-get-key-names-from-json-using-jq

You need to use jq 'keys[]'. For example:
echo '{"example1" : 1, "example2" : 2, "example3" : 3}' | jq 'keys[]'
Will output a line separated list:
"example1"
"example2"
"example3"

没有评论:

发表评论