How to properly use curl for sending JSON data? or Having trouble with curl sending JSON? Any tips?[

14 Replies, 1055 Views

For curl sending json, I always use `--data-binary` instead of `-d` to avoid any weird encoding issues. Like this:

```bash
curl -X POST http://example.com/api -H "Content-Type: application/json" --data-binary '{"key":"value"}'
```

Also, Postman or Insomnia are way easier for testing APIs if you’re tired of fighting with curl.

Messages In This Thread



Users browsing this thread: 1 Guest(s)