【发布时间】:2019-12-20 00:09:34
【问题描述】:
我正在使用类似于以下的 JSON 文件:
{ "Response" : {
"TimeUnit" : [ 1576126800000 ],
"metaData" : {
"errors" : [ ],
"notices" : [ "query served by:1"]
},
"stats" : {
"data" : [ {
"identifier" : {
"names" : [ "apiproxy", "response_status_code", "target_response_code", "target_ip" ],
"values" : [ "IO", "502", "502", "7.1.143.6" ]
},
"metric" : [ {
"env" : "dev",
"name" : "sum(message_count)",
"values" : [ 0.0]
} ]
} ]
} } }
我的目标是显示标识符和值的映射,例如:
apiproxy=IO
response_status_code=502
target_response_code=502
target_ip=7.1.143.6
我已经能够使用
解析名称和值.[].stats.data[] | (.identifier.names[]) 和.[].stats.data[] | (.identifier.values[])
但我需要 jq 映射值的方法的帮助。
【问题讨论】: