Call a JSON API from PowerShell
PowershellInvoke-RestMethod parses the response for you, so no ConvertFrom-Json step is needed.
$headers = @{ Authorization = "Bearer $token" }
$body = @{ name = 'example' } | ConvertTo-Json
Invoke-RestMethod -Uri 'https://api.example.com/items' `
-Method Post -Headers $headers -ContentType 'application/json' -Body $body