【发布时间】:2018-12-12 11:44:12
【问题描述】:
我在example.json 文件中有一个带有数字键的 json 对象:
{
"1": "foo",
"2": "bar"
}
我想通过jq按键获取它的属性,我试过了:
$ jq ."1" example.json
0.1
和
jq .["1"] example.json
jq: error (at example.json:4): Cannot index object with number
结果应该是
"foo"
虽然。
【问题讨论】: