How can i pass a JSON string in the JSON body of the HTTP request? The request is sent by ServiceNow to Azure Devops to set the content of a pipeline variable. The Json body is as below:
{
"resources":{
"repositories":{
"self":{
"refName":"refs/heads/master"
}
}
},
"variables":{
"request":{
"value":"{"key1": "value1"}" #here, i declare the json string
}
}
}
"{"key1": "value1"}"
is the json string that i want to pass (this is just a sample of the string).
I have tried backslash '' in front of the braces. "\{"key1": "value1"\}"
It didn't work.
I have tried to put the braces between single or double quotations. "'{'"key1": "value1"'}'" It didn't work.
Do you have any idea? Maybe it is doable with the ServiceNow's language but i am not expert of it. As Azure Devops only accepts strings as pipeline variables, i have to send the json as a string.
You have to escape the double quotes of the value:
{\"key1\": \"value1\"}