I am using below snippet in my jenking groovy file, where I am getting null response.
def Services= sh(script: "curl -s --header "PRIVATE-TOKEN: ${gittoken}" ${url}| jq -r .${Servicename}[]", returnStdout: true)
file which I am downloading is like below.
{
"FrameWork1": [
"sample/sample1",
"sample/sample2"
]
}
Basically I am getting values of Framework1
if I give below one I am getting the first value of Framework object
Working one:###############
def Services= sh(script: "curl -s --header "PRIVATE-TOKEN: ${gittoken}" ${url}| jq -r .${Servicename}[1]", returnStdout: true)
1
jq
filter should be .FrameWork1[]
to get a list of strings
https://jqplay.org/s/3iCv-off4ep
1