As happens from time to time, you will want to work with JSON data. For example, when passing JSON data when using httpPut() or httpPost().
In this example, I will be using the this REST API example from the Atlassian Community.
As is shown in the example, we start with the example JSON that will be used to input.
|
Use the Find/Replace feature of the SIL Manager to add an escape character before every quote.
Surround each line with quotes and place a plus sign at the end.
Set the newly formatted JSON to a string variable and put a semicolon at the end.
Use the Find/Replace feature of the SIL Manager to add an escape character before every quote.
Surround each line with quotes and place a plus sign at the end. Place a semicolon at the end.
Set the entire code block to a string variable so that it can be passed into the REST endpoint.
|
The output should match the original JSON from the beginning.
Add a variable and use plus signs to concatenate it to the existing string values. Again, the output should match the original JSON from the beginning.
Below we use httpPut() to pass the "updateInfo" values to update the Service Desk value "isPublic" to false.
|
Need help implementing this script? Talk to me directly to me by clicking on the bot on this page.
The content by label feature displays related articles automatically, based on labels you choose. To edit options for this feature, select the placeholder below and tap the pencil icon.
|