PowerShell Snippets: Format Json for Curl
Views (50)
This post is part of the series on PowerShell Snippets.
The following PowerShell shows the format required for use in Curl (which I will cover in the next post of this series). It took me a number of attempts to get the format correct; the backticks (`) are needed to escape the double quotes (") for PowerShell and the backslashes (\) to escape them for the curl command:
$json = "
{ \`"tag_name\`": \`"$ghTag\`", \`"target_commitish\`": \`"main\`", \`"name\`": \`"$ghTag\`", \`"body\`": \`"$ghTag release\`", \`"draft\`" :false, \`"prerelease\`": false, \`"generate_release_notes\`": false }
"
Read original post PowerShell Snippets: Format Json for Curl at azurecurve|Ramblings of an IT Professional
This was originally posted here.

Like
Report
*This post is locked for comments