How to Properly POST JSON Data Using cURL? or What’s the Correct Way to POST JSON with cURL?

18 Replies, 1502 Views

If you’re on Windows, escaping is even worse. Use PowerShell’s `Invoke-RestMethod` instead:

```powershell
Invoke-RestMethod -Uri http://example.com/api -Method Post -Body '{"key":"value"}' -ContentType 'application/json'
```

Way cleaner than fighting with curl’s escaping rules.

Messages In This Thread



Users browsing this thread: 1 Guest(s)