[英]How to get name value in the below json file
[
{
"_class": "hudson.model.FreeStyleProject",
"name": "actual_build",
"url": "http://tepl.tallycloudinfra.com:8080/job/actual_build/",
"color": "blue",
"fullname": "actual_build"
},
{
"_class": "hudson.model.FreeStyleProject",
"name": "CIS_TEPL_QA_Deploy",
"url": "http://tepl.tallycloudinfra.com:8080/job/CIS_TEPL_QA_Deploy/",
"color": "blue",
"fullname": "CIS_TEPL_QA_Deploy"
},
{
"_class": "hudson.model.FreeStyleProject",
"name": "cktest",
"url": "http://tepl.tallycloudinfra.com:8080/job/cktest/",
"color": "red",
"fullname": "cktest"
},
{
"_class": "hudson.model.FreeStyleProject",
"name": "Create_New_DB_Structure",
"url": "http://tepl.tallycloudinfra.com:8080/job/Create_New_DB_Structure/",
"color": "blue",
"fullname": "Create_New_DB_Structure"
}
]
I tried below jq command i'm getting this error.我在 jq 命令下尝试了这个错误。
Error:错误:
jq -r '._class[].name' f1.json
jq: error (at f1.json:30): Cannot index array with string "_class"
jq -r '._class.name' f1.json
jq: error (at f1.json:30): Cannot index array with string "_class"
With your input,有了您的输入,
jq '.[].name' f1.json
yields产量
"actual_build"
"CIS_TEPL_QA_Deploy"
"cktest"
"Create_New_DB_Structure"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.