0
我有以下的JSON數據使用JQ用支架取一個值
"cumulativeStatistics": [
{
"Mean_Test_Time_(ms)": 481.6876712328767,
"Response_bytes_per_second": 10514.456156404525,
"Errors": 0.0,
"testNumber": 1.0,
"TPS": 2.141001049970378,
"testDescription": "Some status",
"Mean_time_to_first_byte": 481.1034246575342,
"Tests": 1460.0,
"Peak_TPS": 4.0
},
{
"Mean_Test_Time_(ms)": 453.88211103495547,
"Response_bytes_per_second": 10507.254474105619,
"Errors": 0.0,
"testNumber": 2.0,
"TPS": 2.1395346108950557,
"testDescription": "Status Again",
"Mean_time_to_first_byte": 453.4825222755312,
"Tests": 1459.0,
"Peak_TPS": 4.0
}
我用下面的JQ這是能夠走出除了Mean_Test_Time_(MS)所有其它參數,因爲括號
的cat sample.data | jq '.perf.cumulativeStatistics[0].Response_bytes_per_second'
這是解釋括號本身。因此,當我使用Mean_Test_time_(ms)與該命令時,出現以下錯誤
error: syntax error, unexpected '(', expecting $end
.perf.cumulativeStatistics[0].Mean_Test_Time_(ms)
如何避免這些錯誤?
謝謝!