【发布时间】:2017-07-08 11:31:25
【问题描述】:
我有大量来自第 3 方系统的 JSON,我想用 jq 对其进行预处理,但我在编写查询时遇到了困难,测试用例如下:
$ cat test.json
{
"a": "b",
"c": "d",
"e": {
"1": {
"f": "g",
"h": "i"
}
}
}
$ cat test.json|jq .e.1.f
jq: error: Invalid numeric literal at EOF at line 1, column 3 (while parsing '.1.') at <top-level>, line 1:
.e.1.f
如何将“g”作为我的输出?或者我如何将该 1 转换为“1”以便正确处理?
【问题讨论】: