I’m trying to build a job by passing JSON parameter for Jenkins through Linux CLI. But I’m not able to pass the parameters in JSON. I have used -g to turn off globbing. Still the issue persists. Any help would be appreciated.
curl -X POST -u username:password -g JENKINS_URL/job/Bulk_Job/buildWithParameters?serviceBranchJson="{"key1":"value1","key2":"value2"}"}
Error message
Processing provided DSL script
{key1:value1,key2:value2}}
groovy.json.JsonException: expecting '}' or ',' but got current char 'k' with an int value of 107
The current character read is 'k' with an int value of 107
expecting '}' or ',' but got current char 'k' with an int value of 107
line number 1
index number 1
{key1:value1,key2:value2}}
Code snippet
import groovy.json.JsonSlurper
def serviceBranchJson = serviceBranchJson
println(serviceBranchJson)
Map servicesMap = new JsonSlurper().parseText(serviceBranchJson)