jq '.' 是什么意思做?
What does jq '.' do?
如何jq '.'解析 json 并显示 ?
curl 'https://api.github.com/repos/stedolan/jq/commits?per_page=5' | jq '.'
我看到 json 已正确解析和显示
What is the implementation behind " xxxx | jq '.' "
我怎么理解?
.
The absolute simplest (and least interesting) filter is .
. This is a filter that takes its input and produces it unchanged as output.
Since jq
by default pretty-prints all output, this trivial program can be a useful way of formatting JSON output from, say, curl
.
在jq编程语言中,.
指的是一个过滤器的隐式输入。例如,def f: .;
定义了一个函数 f
,它按原样输出其隐式输入。
请注意,在过滤器参数中,过滤器可以更改 .
所指的内容:例如,map(f)
定义为 [.[] | f]
;在jq程序中[1, 2, 3] | map(. + 1)
,.
指的是数组的每一个元素。
除了 jq .
漂亮地打印输出外,如果无法解析输入文件,它还会发出警告。因此,测试未知 JSON 文件以查看源文件是否存在语法问题很方便。
如何jq '.'解析 json 并显示 ?
curl 'https://api.github.com/repos/stedolan/jq/commits?per_page=5' | jq '.'
我看到 json 已正确解析和显示
What is the implementation behind " xxxx | jq '.' "
我怎么理解?
.
The absolute simplest (and least interesting) filter is
.
. This is a filter that takes its input and produces it unchanged as output.Since
jq
by default pretty-prints all output, this trivial program can be a useful way of formatting JSON output from, say,curl
.
在jq编程语言中,.
指的是一个过滤器的隐式输入。例如,def f: .;
定义了一个函数 f
,它按原样输出其隐式输入。
请注意,在过滤器参数中,过滤器可以更改 .
所指的内容:例如,map(f)
定义为 [.[] | f]
;在jq程序中[1, 2, 3] | map(. + 1)
,.
指的是数组的每一个元素。
除了 jq .
漂亮地打印输出外,如果无法解析输入文件,它还会发出警告。因此,测试未知 JSON 文件以查看源文件是否存在语法问题很方便。