How to properly send curl post data with headers and parameters? or What's the best way to format cur

18 Replies, 1087 Views

Bro, escaping JSON in bash is a nightmare. Use `jq` to generate the payload:
```bash
curl -X POST https://example.com/api -H "Content-Type: application/json" -d "$(jq -n --arg key "value" '{key:$key}')"
```
Way cleaner and avoids quote issues.

Messages In This Thread



Users browsing this thread: 1 Guest(s)