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

14 Replies, 1003 Views

Pro tip: use `@` to load JSON from a file instead of typing it out. Saves headaches with escaping:

```bash
curl -X POST http://example.com/api -H "Content-Type: application/json" -d @data.json
```

Also, `jq` is a lifesaver for debugging JSON. Install it and pipe your output to `jq .` to pretty-print responses.

Messages In This Thread



Users browsing this thread: 1 Guest(s)